Dear All:
I am working on a project in the university, one part of the project is to program the C167CR controller so that it can receive RS485 signals from other controller and based on the received data (which is Frequency & Duty cycle) the C167CR will generate PWM signal/s. Now, I have to build a prgram that enables the build in RS485 on the MiniModule-167, in order to be able to comunicate with the other controller. I have checked the manuals and the articles on the Keil website, but unfortunately there is nothing about RS485.
Please advise.
Your suggestions and help are highly appreciated
Thank you in advance
Best Regards,
Hello Hakam, RS485 is only a standard for the electrical parameters of the data transfer. Try a search at the internet. Then read the datasheet of the MiniModule how the manufacturer of the module (!) realised it.
Dear UlfSass, Thank you for your reply. Actually I have read the manual of the miniModule167, and it is not comprehensive, it is mentioned that there is oneRS232 DB-9 socket and the other DB-9 socket can be used as CAN or RS485, but the question how I can access this socket (I mean from the C code)how I can program the second socket in order to configure it as RS485. I need a help in writing the code!
Thank you for your time.
Dear Hakam,
I suppose you have the development board PHYTEC MM-499-L2 in addition to the minimodule167. The minimodule 167 has an external UART (additional serial interface) which you could use for your RS485 communication. There is a driver for that UART mentioned (on the CD).
As I read at the moment there is no RS485 transceiver on the board. You have to add it to the development board and connect it to TX2 and RX2 of the minimodule(TTL level of external UART) and the DB9 connector.
Dear Ulf Sass:
Actually the development board which I have is MM-Basis-1117.4, and as mentioned in the manual, I just need to change the configurationof some jumpers in order to connect the Rs-485 driver to DB-9 socket at P2.
My problem is, how I can build the C code so that I can program the P2 as RS-485, also how I can program the C167 microcontroller in order to receive the data stream from other microcontroller (through RS-485).
As per your advise, I look for the CAN driver, and I found it.
Thank you for your support.
Then you just have to change these jumpers.
About software - there are no established standard for RS485 communication. You need similar ISR as for normal RS232.
The thing is that it is half-duplex, so the master must turn off the transmission to be able to hear the answer from the other side. That means that the RS485 transceiver on the board must have a transmit-enable signal connected to the processor. It may also have a receive-enable signal but normally not.
Your job it to turn on transmission, send a packet, and as soon as the last byte has been sent out, turn data direction and wait for an answer. So, no real need for any RS485 source code. Just an understanding of when en how to enable/disable the output from the RS485 transceiver.