LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

please help with serial communication

i make simulation for my circuit using proteus to convert sine wave from analog to digital and send it through serial port i receive it on labview by connecting the two programs now i want to regain my sine wave  shape as it was before how to do that and plot it
0 Kudos
Message 1 of 20
(4,953 Views)

Use Digital to Analog vi and send analog output to a Waveform Graph.

 

WfmConvert.png

 

 

Ooops.  I forgot that when sending and receiving serial, the data will get converted to ASCII characters and be received back as ASCII.  You can use Type Cast to convert the returning characters back to numbers (which should be a series of 1s and 0s since you sent digital data.  Then load the 1s and 0s into the Build Waveform function and then send it into Digital to Analog vi.

 

Message Edited by tbob on 05-28-2010 04:52 PM
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 20
(4,947 Views)
i said i read from serial port digitized signal how to regain the same shape on lab view
0 Kudos
Message 3 of 20
(4,940 Views)
what do you mean by then load the 1s and 0s into the Build Waveform function and then send it into Digital to Analog vi.
0 Kudos
Message 4 of 20
(4,930 Views)

How many bit do your AD converter have? And also do you know how a AD converter works? Then you send data on a serial port the data is broken up in single bytes. At the receiver end the data is recombined to its original form. The typecast function is useful for this purpose.

Have you any code you can show us. It would help. 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 5 of 20
(4,903 Views)

i know AD conversion and i convert data to string then send it via serial port

when i receive it on labview by simulation i convert it from string to number and i display it on graph but it didnt give the sine waveform 

its a simple question how to regain my signal on its shape

0 Kudos
Message 6 of 20
(4,894 Views)

Which Labview version do you use? Also how many bit is your AD. I think I may help you. But that require that you post your current code! No code no help. And please you must tell us in more detail, why you struggle



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 20
(4,889 Views)

using labview 8 ,i use 10 bit ADC this code  was written in microbasic

 

 

  program ADC_10
dim temp_res as word
dim output as string[5]
DIM AD_RES AS WORD


USART_INIT(9600)
main:
TRISA = %111111 ' Port A is input


trisb=0
TRISD = %00000000
ADCON1 = %1000010 ' Port A is in analog mode,
' 0 and 5V are reference voltage values,
' and the result is aligned right
' (higher 6 bits of ADRESH are zero).
ADCON0 = %00000001
Delay_ms (1) ' 1 ms pause
eloop:
ADCON0.2 = 1 ' Conversion starts
wait:
' wait for ADC to finish
Delay_us(50)
if ADCON0.2 = 1 then
goto wait
end if
temp_RES=ADC_READ(0)
PORTD=LO(temp_RES) ' Set LOWER 8 bits on port D
Delay_ms(1) ' 1 ms pause

while true
if Usart_Data_Ready = 1 then ' Check if there is data received
' if Usart_Read = "g" then ' is it "g" ?
Usart_Write(13) ' Write CR
Usart_Write(10) ' ... and LF
temp_res = ADC_read(0) ' Read ADC
WordToStrWithZeros(temp_res, output) ' Convert result to string
Usart_Write_Text(output) ' Send string to Usart
Usart_Write(13) ' CR
Usart_Write(10) ' LF
'end if
end if
wend
end.

Message Edited by sfhj on 05-30-2010 01:19 AM
0 Kudos
Message 8 of 20
(4,867 Views)

As homer simpsons would have said D'oh!. This is a Labview forum. So posting Basic code is not the correct thing to do LOL. Then I asked you to post code I meant Labview code. So I could get an idea of how much you understand, and whay you do not not understand. I have made some code to simulate your setup. You should be able to solve your problem now.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 9 of 20
(4,857 Views)

thank you for your reply

but it seem that you dont got me i asked about connecting labview with serial port to read and write and plot the  signal that i input it after digitizing and i said also that i did ADC AS HARDWARE NOT SOFTWARE if it wasnot hardware  what is the use 

thanks

0 Kudos
Message 10 of 20
(4,843 Views)