Dout and Din pins on PCAN-RS-232

Programmable Converter for RS-232 to CAN
Post Reply
AcmarAuto
Posts: 1
Joined: Tue 15. Mar 2016, 14:45

Dout and Din pins on PCAN-RS-232

Post by AcmarAuto » Tue 15. Mar 2016, 14:51

Hello,
i would like and example in 'C' code to use :
1.pin 5 Dout (output) with HW_SetDOUT ?
2.pin 6 Din (input) with HW_GetDIN ?
on PCAN-RS232?
Regards

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Dout and Din pins on PCAN-RS-232

Post by PEAK-Support » Wed 16. Mar 2016, 11:04

please see Header file on product Disk

Code: Select all

//! @brief
//! Read digital inputs. Each bit will represent a digital pin.
//! Not available on PCAN-Router Pro
//!
//! @param		buffer		Buffer for DIN-value
//!
//! @return		one error of HW_ERR_...
HWStatus_t  HW_GetDIN ( u32_t  *buffer);


//! @brief
//! Set digital outputs. Each bit will represent a digital pin.
//! Only available on PCAN-RS-232.
//! 
//! @param		buffer		Buffer for DOUT-value
//!
//! @return		one error of HW_ERR_...
HWStatus_t  HW_SetDOUT ( u32_t  *buffer);
Here a simple code part how to use it:

#read the input:

Code: Select all

HW_GetDIN (&inbuf);
if ((inbuf&1) == 1) // Din1 = hi ? -- means PIN 6 of Module
{...}
#set the output:

Code: Select all

outbuf = 1;
HW_SetDOUT (&outbuf); // Dout-1, low-active: 0=open, 1=GND !!!  -- means PIN 5 of Module
We will create a #define for the DIO in the next release of the Firmware to keep it more simple!
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Dout and Din pins on PCAN-RS-232

Post by PEAK-Support » Fri 18. Mar 2016, 15:43

We now have add a sample projekt for the Digital I/O to the product information.
Please see sample 8 on the Product DVD in the section Develop - Microcontroller hardware - PCAN-RS232 - Examples.

main.c
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply