Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC16F877A+UART for LABVIEW

Status
Not open for further replies.

noel_t

Junior Member level 3
Junior Member level 3
Joined
May 31, 2011
Messages
30
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Visit site
Activity points
1,592
I need to send four measurement parameters to the PC for display and storage purposes. The software for this aim is LABVIEW. I am new to PIC and Interfacing, but by putting so much effort and asking questions from experts, i could have accomplished the acquisition of all the data till today.
I could also transmit a character "HELLO" through RS232 with my UART to USB converter and the result in hyperterminal was observed as well.
I am quite happy that i could have reached up to this stage. but on the other hand, unfortunately my knowledge is absolutely poor about LABVIEW.
I have heard that if i have control over the format of the data from PIC to LABVIEW, it is not that difficult.
Please find the attached pictures of the design for better understanding.

Questions:
1- can you please explain what is exactly meant by format of data?(I also don't know the format of data i sent through USB)
2- After specifiying the format, what would be the next stage?
3- If it is possible, please provide me with some sample codes for Hi-tech C, and LABVIEW as well.
 

Attachments

  • PIC16F877A+UART for LABVIEW.pdf
    920.8 KB · Views: 147

Questions:
1- can you please explain what is the technique to transmit the 10-bit data from PIC ADC to the 8-bit serial port? something like this:

do {
for (i=0; i <=7; i++) {
myarray=read_temp();
}

for (i=0; i <=7; i++) {
putch (Lo(myarray)); //send the lower 8 bits of ADC reading
putch(Hi(myarray)); // Send upper 8 bits of ADC reading
}

2- How to identify each channel at the reception side (LABVIEW). For example, 1011011110=Channel 0 (ADC-1=Light) or 1011010110=Channel 1 (ADC-1=temperature) and so on. Something like this can work?

do {
an0 = ADC_Read(0) >> 2;
USART_Write(an0);
an1 = ADC_Read(1) >> 2;
USART_Write(an1);

an2 = ADC_Read(2) >> 2;
USART_Write(an2);

an3 = ADC_Read(3) >> 2;
USART_Write(an3);

an4 = ADC_Read(4) >> 2;
USART_Write(an4);

Thanks in advance for your help.
 

    Minh trí

    Points: 2
    Helpful Answer Positive Rating
4 parameter, what is the maximum number for that value?
Is that 8bit is enough for the value?
ex
Code:
for(i=0;i<=3;i++) value[i]=read_a2d(i);
for(i=0;i<=3;i++) uart_transmit(value[i]);
 
  • Like
Reactions: noel_t

    noel_t

    Points: 2
    Helpful Answer Positive Rating
4 parameter, what is the maximum number for that value?
Is that 8bit is enough for the value?
ex
Code:
for(i=0;i<=3;i++) value[i]=read_a2d(i);
for(i=0;i<=3;i++) uart_transmit(value[i]);
This is 10-bit value since it is produced by PIC16F877A with 10-bit resolution.
 

Every parameter need to divide into upperbyte and lowerbyte.
Code:
for(i=0;i<=3;i++) value[i]=read_a2d(i);
for(i=0;i<=3;i++){
     uart_transmit((value[i]>>5)&0b00011111);
     uart_transmit(value[i]&0b00011111);}
 
Last edited:
  • Like
Reactions: noel_t

    noel_t

    Points: 2
    Helpful Answer Positive Rating
Every parameter need to divide into upperbyte and lowerbyte.

i don't get the difference between uart_transmit((value>>5)&0b00011111); and uart_transmit(value&0b00011111);}
what is the meaning of 5 at here?
If you want to have the upper byte should not you &(AND) it with 0b11111000?
 

i don't get the difference between uart_transmit((value>>5)&0b00011111); and uart_transmit(value&0b00011111);}
what is the meaning of 5 at here?
If you want to have the upper byte should not you &(AND) it with 0b11111000?

It shift right 5 bit.
 
  • Like
Reactions: noel_t

    noel_t

    Points: 2
    Helpful Answer Positive Rating
It shift right 5 bit.

Now exactly i got your meaning. Thus, it transmit the upper byte first and lower byte second for values of i=0;i<=3. (It means 1=light, 2= temperature 3= voltage, 4= current).
Do you have any idea on how to joint this upper byte and lower byte at the other side (PC with labview)?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top