Having problems communicating between my 8051 and labview/HyperTerminal. I seem to get the wrong information received to both pc and 8051. I know the path is ok because I use it to flash using isp
When I receive from pc I get random data received and displayed on a port but not so random that the data sent will display differently on the port each time. . . like the same data sent will display the same random data each time. But the data I do receive seems to be a little glitchy, on receive it will flash a number of leds for a split second and keep others fully lit up. I get a number of dull, fully lit and off led’s when I repeat the communication with small delay.
Im just using the serial VISA example or Hyper Terminal set up like this:
Com 1 (no risopnce at all form com 2)
Baurd rate. 4800 (have tried others)
Bits. 8
Parity. None
Stop. 1
Flow. None
Delay R/W. 500ms (on labview only)
is my code
Write a program for the 8051 to receive bytes of data serially, and
put them in P1, set the baud rate at 4800, 8-bit data, and 1 stop bit
Solution:
MOV TMOD,#20H ;timer 1,mode 2(auto reload)
MOV TH1,#-6 ;4800 baud rate
MOV SCON,#50H ;8-bit, 1 stop, REN enabled
SETB TR1 ;start timer 1
HERE: JNB RI,HERE ;wait for char to come in
MOV A,SBUF ;saving incoming byte in A
MOV P1,A ;send to port 1
CLR RI ;get ready to receive next byte
SJMP HERE ;keep getting data
can anyone help?? Thank you