Hi.
I want to install a small buzzer in a vehicle build and control it via the Dout pin.
I did not find any code example of how to set this up (for example, how to set output voltage) and trigger it...
how to use digital out (Dout)
-
- Sales & Support
- Posts: 1083
- Joined: Fri 20. Sep 2019, 13:31
Re: how to use digital out (Dout)
Hello,
Please have a look at the example 03_TIMER_IO, this example
uses a CAN-message to set the low side switch:
For more information on the digital output please
have a look at the PCAN-Router FD documentation on page 32:
https://www.peak-system.com/produktcd/P ... an_eng.pdf
Best Regards
Marvin
Please have a look at the example 03_TIMER_IO, this example
uses a CAN-message to set the low side switch:
Code: Select all
// catch ID 334h to control the low-side switch
if ( RxMsg.id == 0x334 && RxMsg.msgtype == CAN_MSGTYPE_STANDARD)
{
uint32_t dig_out;
// default OFF
dig_out = 0;
if ( RxMsg.data8[0] & 1)
{
// switch load to GND e.g. relay
dig_out |= 1;
}
HW_SetDOUT ( &dig_out);
}
// forward message to CAN2
CAN_Write ( CAN_BUS2, &RxMsg);
}
have a look at the PCAN-Router FD documentation on page 32:
https://www.peak-system.com/produktcd/P ... an_eng.pdf
Best Regards
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: how to use digital out (Dout)
Her some additional Information for using the IO´s on the Router FD
The Router FD have 3 IO Pins. They could be used as 1Dout and 2Din, or 3 Din.
reading
Din0 --> Value 1 Read Din0 as High
Din1 --> Value 2 Read Din1 as High
Din2 --> Value 4 Read Din2 as High
write
Dout0 --> Value 1 Set active --> activate low-side switch (pull low)
Dout0 --> Value 0 Set inactive --> de-activate low-side switch
(other values will be ignored)
how to use:
The Router FD have 3 IO Pins. They could be used as 1Dout and 2Din, or 3 Din.
reading
Din0 --> Value 1 Read Din0 as High
Din1 --> Value 2 Read Din1 as High
Din2 --> Value 4 Read Din2 as High
write
Dout0 --> Value 1 Set active --> activate low-side switch (pull low)
Dout0 --> Value 0 Set inactive --> de-activate low-side switch
(other values will be ignored)
how to use:
Code: Select all
uint32_t buff, din0, din1, din2;
HW_GetDIN ( &buff);
din0 = ( buff >> 0) & 1; // bit 0
din1 = ( buff >> 1) & 1; // bit 1
din2 = ( buff >> 2) & 1; // bit 2
For HW_SetDOUT() only bit 0 is used.
uint32_t buff;
// activate low-side switch (pull low)
buff = 1;
HW_SetDOUT ( &buff);
// de-activate low-side switch (high-Z)
buff = 0;
HW_SetDOUT ( &buff);
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: how to use digital out (Dout)
Thank you.
My doubt is resolved and I'm able to use the Dout now.
My doubt is resolved and I'm able to use the Dout now.
