Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/18/05 07:10
Read: times


 
#95244 - Testing Serial communication
Hey I was wondering what program you guys use to test your MCU's serial communication. My MCU is only recieving data not sending. Im using matlab to try to test. But when I send anything my MCU just hangs.

!mode com1:19200,n,8,1
fid = fopen('com1:','w');
data = [00 44 55 255]
fwrite(fid,data,'int8');
fclose(fid);

Thats the code to send to the MCU 00 44 55 255

heres my serial code

SERIAL:
push acc
push psw
mov psw,#010h
clr a
mov g,a
jnb RI,NORECI
WHILE:
mov a,SBUF
cpl a
jz NORECI
mov a,#080h
add a,g
mov r0,a
mov @R0,SBUF
clr RI
WHILE2:
mov c,RI
clr a
rlc a
xrl a,#001H
jz NEWBUF
sjmp WHILE2
inc g
sjmp WHILE ; Loop
NORECI:
clr a
mov g,a
mov k,a
pop psw
pop acc
reti ; Return

everything looks right, but it just hangs.

List of 4 messages in thread
TopicAuthorDate
Testing Serial communication            01/01/70 00:00      
   Simulator            01/01/70 00:00      
   terminal            01/01/70 00:00      
      Previously on 8052.com            01/01/70 00:00      

Back to Subject List