LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

comunication with AT89S51 microcontroler through COM port?

Highlighted

Hi, Everyone. I have a problem when comunication Labview with AT89S51 microcontroler through COM Port. When I send a character ( example sent "a" ) from write buffer in write VISA, but on Read buffer in read VISA don't display correct that character ( not "a" ).

 Would you please check and help me this problem. Thanks you. Funny!

this my code on AT89S51 and code labview.

 

AT89S51:

org 0h
    jmp init
    org 30h
init:   
    mov scon, #01010000b    ;     Mode 1
    mov tmod, #00100000b    ;    Timer 1 mode 2
    mov th1, #0f9h                  ;    baund rate 9600 bps( crystal 12 MHz)
    setb tr1
    clr ri
    clr ti
start:
    jnb ri, $
    clr ri
    mov a, sbuf
    mov sbuf, a
    jnb ti, $
    clr ti
    jmp start

 

Message Edited by aludlak on 04-30-2009 08:09 PM
0 Kudos
Message 1 of 17
(1,762 Views)
Highlighted

Can't open your code (I only 8.2.1 at work), but a couple of ideas occur to me:

 

1) Check all the settings (baud rate, etc).

2) Check whether both are sending/receiving same endian order.

3) Check ASCII code and see what you are getting vs. what you sent.

 

I usually like to write out what I sent in both hex and binary and do the same with what I read to see if there is anything obvious.

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 2 of 17
(1,756 Views)
Highlighted

Thanks MattBradley!

I used default 8bit data, 1bit stop. I attachment the pictures code and error. Could you please see again.

0 Kudos
Message 3 of 17
(1,750 Views)
Highlighted
Right click on the indicator and select 'Hex Display'. I also have no idea how you have programmed the micro for parity, data, and stop bits. The only comment in there is for baud rate.
0 Kudos
Message 4 of 17
(1,739 Views)
Highlighted

Hi, Dennis Knutson.

I moved #0101000b to SCON register, mean set SCON.6 and SCON.4 => selected mode 1 of Serial port operates. In this mode, 10 bits are transmitted  on TXD or received on RXD. These consist 1 start bit, 8 data bits, 1 stop bit. I thinks my Labview program not good ( wrong). But I don't know where it wrong. I selected "hex display" follow you but it don't have any difference. Now I don't have any idea to do this project continue. Could who help me please. Thanks.

0 Kudos
Message 5 of 17
(1,727 Views)
Highlighted

Download this document http://www.atmel.com/dyn/resources/prod_documents/DOC4316.PDF And read section 2.13. Pay attention to details Smiley Very Happy. I can tell now that there is something wrong with your baudrate generation. Are sure you can generate a 9600 baudrate with a 12MHz osc and timer 1. Also did not like your Labview test program. You do not need those frames at all. And I also do not hope you are running with the continuous run button. Go to find examples and then search for serial. Then select the "Advanced Serial Write and Read.vi" If you modify it please use the save as option so other may use it after you. But nice to see some real assembler coding againSmiley Happy

Here is some useful tips for the Labview beginner (we have all been there some time)

1)Then starting a new Labview session enable context help (Ctrl+h). Do not be afraid to use the detailed help option

2)Then stuck, go to help in the toolbar then select find examples



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 17
(1,716 Views)
Highlighted

Hi, Coq rouge happy to see you again.Smiley Tongue

I read a ducument about 8051 by mother stongue not yet read English, In there written with crystal 12MHz generate 9600 baud rate by timer 1 will have error 7%. I thought it still use ok. I'll change it as 11.0592 MHz. You want to say in my Labview program don't need use "Flash Sequence Structured"? I teach myself Labview so very slowly. Hope receive many help from you and everyone in there.  Thanks  you,  have funny. See you late.

Message Edited by aludlak on 05-01-2009 06:35 AM
0 Kudos
Message 7 of 17
(1,708 Views)
Highlighted
In the document that I gave you a link to. Take a look at Figure 2-21. You may select lower baudrates than 9600


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 8 of 17
(1,703 Views)
Highlighted

And it seems you did not do the simple task of changing to hex display.Smiley Sad

 

If you don't think your LabVIEW program is correct, use one of the shipping examples or try the windows porgram hyperterminal. Hyerterminal is an easy check. If your text is garbled there, you know you have something wrong on the micro end (and I strongly suspect you do).

0 Kudos
Message 9 of 17
(1,696 Views)
Highlighted

Hi, I still use crystal 12 Mhz to generate 4800 baud rate ( moved #0f3h to th1). I changed to " Hex display" follow Dennis knutson. I used "Serial Write and Read Basic.vi" or "Advanced Serial Write and Read.vi" of the examples. All things I did still have error. I never use Hyerterminal to check RS - 232 so I don't know use it. And I can't see the wrong in my micro, could you say me it? Have when my hardware wrong? But I think it still good when see error.Smiley Sad

This errors appear in my test 


Message Edited by aludlak on 05-01-2009 08:04 PM
0 Kudos
Message 10 of 17
(1,669 Views)