cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

read data from pic18f452 to labview

read data from pic18f452 to labview

Hi, I'm currently using labview to receive data sent from the microcontroller PIC18f452. I'm using visa to receive data from the pic. But the problem is the read result always zero!! I'm use a virtual serial port to interface Proteus with labview.. Also i connect the RS-232 in Proteus to a virtual terminal to enable me to see what is sent.. Although there is an output in this virtual terminal and i see that data is sent (but not alwayes!! som times it dosn't appear any thing); i cant see that this data is sent to labview.. also the baud-rate of sent and received bytes in Virtual serial port is zero>> this picture show the problem please >> i need your help>> and i need someone to advice what to do or what i need to solve the problem .. Regards.

0 Kudos
Message 1 of 9
(1,410 Views)

Re: read data from pic18f452 to labview

There are lots of reasons why this many not be working. You don't show us any code, so it's impossible to say with certainty. You may have the VISA configured to stop reading when it sees a termination character. You may not. You may not be waiting long enough for a read. You may be. Is the PIC always sending data, or does it send it only when it receives a command? If the latter you may not be appending the proper termination character that the PIC program expects to see to indicate the end of a message. Then again, you may be.

 

Please upload your code.

0 Kudos
Message 2 of 9
(1,377 Views)

Re: read data from pic18f452 to labview

Thanks.. a lot for your replay..

I think you are right in all what you say.. I post in the attachments the code and the Proteus .. the project is very large>> so i will give you a simple idea of it..

As i say before the principal idea for this project is to send the weather sensor results from the first circuit (the code to do that is "transmitter" ) and then receive it in the other circuit via RF module ( the code to recive data in the other pic and send it to PC via RS-232 is the " try"). I think the problem  is in this code "try"..

 

if you need to attach the labview >> i will do that

0 Kudos
Message 3 of 9
(1,362 Views)

Re: read data from pic18f452 to labview

I wasn't asking for the PIC code. I was asking for the LabVIEW code. That's the part that's not working, right?

0 Kudos
Message 4 of 9
(1,351 Views)

Re: read data from pic18f452 to labview

I'm didn't wright any code in the labview. i depend only in the graphical interface. my work on labviw is in the attachment.. please.. see it and check  it for me>> where is the wrong ??

0 Kudos
Message 5 of 9
(1,340 Views)

Re: read data from pic18f452 to labview

 


@fooofaaa wrote:

I'm didn't wright any code in the labview. i depend only in the graphical interface.


The "graphical interface" that you are referring to is the code. LabVIEW is a graphical programming environment. Code does not have to be just text. Smiley Wink

 

 

You are not programming properly in LabVIEW. You are programming as if you are using a text-based language. You also have a ton of problems with your code. I can't list them all, but some specific issues:

  • The VISA resource control is not set to any value. Thus, there is no communication that is going to happen. Why is the control hidden? 
  • You should not use the Quit LabVIEW unless you are in the runtime environment. Do you really want LabVIEW to quit whenever you stop the program? Doesn't that make coding and debugging a bit difficult? Use the App.Kind property to detemine if you are in the development environment or the RunTime environment.
  • You do not need to use the Mouse Up event for the buttons. If you leave the buttons to their default "Latch When Released" mechanical action then you can use the "Value Change" event. Place the buttons terminal inside the event case so that LabVIEW can read the button and reset it. You would not need to reset anything. 
  • The "serial port configuration" is just plain wrong. You are constantly opening a new VISA session in each iteration of the loop. WHY?!? Put the serial port initialization outside so that it executes after the loop is done. Also place a small delay inside the loop so you're not pounding the CPU. See Greedy Loop
  • If you do initialize the VISA session with the "serial port configuration" you don't actually do anything with it. The "VISA resource name out" is being passed out of the VI with the valid VISA session, but you're not doing anything with it in the main program. Instead, you're using the hidden control on the front panel of the main VI which isn't set to anthing. 
  • Once you've opened a VISA session you do not need to open it again. In your "Timeout" case you just want to read. Delete the VISA Open function.
  • How do you know you've gotten the full information from the PIC in order to parse it? What if you only get 2 bytes on the serial port? What method of synchronization do you have to know that you've received an entire message with all of the data?
0 Kudos
Message 6 of 9
(1,316 Views)

Re: read data from pic18f452 to labview

Dear smercurio_fc,

thanks a lot for your replay and your  advice >> really there is a lot of things that i didn't take it in my account. 

 

  • I hidden the control because I want it only to take the value which we choose  it from The "serial port configuration".
  • Sorry; i don't what do you mean by "You should not use the Quit LabVIEW unless you are in the runtime environment. Do you really want LabVIEW to quit whenever you stop the program? Doesn't that make coding and debugging a bit difficult? Use the App.Kind property to detemine if you are in the development environment or the RunTime environment." where is the wrong ?? Smiley Indifferent
  • the other comments is very advance for me; I'm really very new in labview. I'm only use it since this month only with self learning!!. So, there is many thing unknown for me >>
Please>> can you help me to modify this "code Smiley Wink" to be better.. What I should to modify??

 

0 Kudos
Message 7 of 9
(1,305 Views)

Re: read data from pic18f452 to labview

Spoiler

Hi EVERYBODY

 

I'am student, and im working on project thats im using LABWINDOWD/CVI (2010) and Pic 18f4550.

I wrote my program on LABWINDOWS, and i program my piv in MICRO PRO C (version 5.60) 

the program of the pic is to read what i write (i mean i write text and i must receive the same text).

i installed Visa, and i arrived to make the connection between ISIS and the LABWINDOWS (i mean i test everything vitually)

but when i write the text, the pic receivit without problems, and the pic doesn't send me the text, and i the LAbwindows show me that i have problem in this function (viread).

Actually i dont know the problem, and i need ur help because i need to start working practiclly on the project soon, and i nees to make sure that virtually i dont have no problem.

 thank

0 Kudos
Message 8 of 9
(815 Views)

Re: read data from pic18f452 to labview

It's silly to use the spoiler to hide your question, silly to post to the LabVIEW board when you are using LabWindows, and silly to create duplicate threads.
http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/VISA-usb-read-problems/m-p/2061116
0 Kudos
Message 9 of 9
(811 Views)