I have a 4200 dev board and I need to be able to communicate using RS485. I do not see any examples in any of the 4xxx sample folders for RS485 communication. The user manual says that it has the capability, however.
In addition to needing a sample file that will work, I also need to know which serial port I would use for RS485, or do any of the serial ports work?
I need to configure the serial port A to communicate two boards by rs485, but I can’t configure any of them. I was reviewing the library RCM33XX and then I was this couple of instructions to configure the serial ports B, C and D:
WrPortI(PCFR, &PCFRShadow, PCFRShadow&0xEA); //clear bit 4,2,0 to normal function
//bits 5,3,1 normally inputs
WrPortI(PCDR, &PCDRShadow, PCDRShadow|0x15); //set bits 4,2,0 high
Well, you can of course just use serAopen(…) to open serial port A and transmit/receive as normal - however for RS485 you need to drive the receiver-enable and driver-enable lines of whichever RS485 chip you are using.
Be aware that Serial Port A is used by the programming cable so any hardware you add which uses PC6 and PC7 must not interfere with the ability to program the module - otherwise you’d need to remove the module from your own board to program it.