rs 485 with lpc2378

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

rs 485 with lpc2378

446 次查看
anumathew
Contributor I

Inorder to check whether my rs 485 is working,i had connected my lpc2378 (rs485) with my PC through ADAM-4561(1 port isolated USB to RS 232/422 485converter).when i open the hyperterminal to see the transmitted data ,nothing is shown.Now how to check it and where to check it?????.i am very new to microprocessor development and am still figuring out the way things work on the LPC2378 . So up front apologies for "stupid" questions.i had done the programing.First time iam doing code with rs 485.MAX3430EPA IC pin REbar and DE is connected to p2(2),RO pin to p2(1) and DI pin is connected to p2(0).This is the code which i have written.          

#include <LPC23xx.H>

 #include <stdio.h>

int main (void)

{

 PCONP |= (1<<4)                       /* power for uart 1 */

PINSEL4 |= 0x0000000A;                 /* Enable TxD1 *//* Enable RxD1 */

PINMODE4=0X0000003A;

FIO2DIR=0X00000037;

FI02MASK=0X00000004;

U1LCR = 0x83;                         /* 8 bits, no Parity, 1 Stop bit */ U1DLM = 0x00;

U1DLL = 69;                           /* 9600 Baud Rate @ 16MHz Clock */

U1FDR = 0x21;

U1LCR = 0x03;                          /* DLAB = 0 */

U1FCR = 0x81;  

while(1) {      

FIO2SET|=(1<<2);               /*TRANSMIT MODE*/      

U1THR = 'A';      Capture.PNG

while (!(U1LSR & 0x40));      

FIO2CLR|=(1<<2);      while (!(U1LSR & 0x01));      

data1 =U1RBR; }  .

while debugging,it is seen that pin 2 is not set in the transmit mode,even if it is given FIO2SET|=(1<<2).what will be the problem.please help Is my code correct,if not please help me with changes. .please provide valuable suggestions.

0 项奖励
1 回复

313 次查看
CarlosCasillas
NXP Employee
NXP Employee

Hi,

Before connecting the MCU to external device, first it is recommended implementing a “loopback test”, in order to verify that pins are properly configured (the signal can be visualized with a scope), and measuring the signal timing (in this case, ensuring the correct baudrate settings) before and after the PHY (validating level-shifting functionality).

As additional information, you could refer to the following links:

https://community.nxp.com/message/796342

http://stackoverflow.com/questions/12472883/two-lpc1765-devices-communicating-through-rs-485


Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励