RodolfoAcialdi Posted November 1, 2007 Report Share Posted November 1, 2007 Hi. I'm a beginner of LabVIEW and i'm using the ADuC841 (with a 12-bit A/D converter) microcontroller to acquire a RMS voltage signal and send it through serial port at 9600 baud 8N1. But, the A/D have a 12 bit register (4 bits for the higher part and 8 bits for the lower part). So, to get the correct reading from the A/D i must joint these two parts of the A/D register into a 12 bit word. Does anybody have an idea for this? I thought about waiting for 2 terminations characters ("\n" = 0x0A) and then joint them. The program to joint then and show it is almost done but, i have no idea to make a condition to change into MSB and LSB part after a termination character and them joint these two parts. If anybody else have another idea, please tell me. Thanks a lot. Quote Link to comment
eaolson Posted November 1, 2007 Report Share Posted November 1, 2007 QUOTE(RodolfoAcialdi @ Oct 31 2007, 01:32 PM) So, to get the correct reading from the A/D i must joint these two parts of the A/D register into a 12 bit word. Does anybody have an idea for this? From serial communication, you will get bytes. LabVIEW doesn't have 12-bit data types, so you will have to store the results in at least a 16-bit integer. Look under the Data Manipulation sub-pallette, under the Numeric Pallette for the VIs you'll need, most specifically Join Numbers. Depending on how your data is transmitted, you may also need Logical Shift or Swap Bytes. If your data is unsigned, you don't care about the highest 4 bits of the result. Be careful if your result is supposed to be signed, that can be trickier. Quote Link to comment
RodolfoAcialdi Posted November 2, 2007 Author Report Share Posted November 2, 2007 QUOTE(eaolson @ Oct 31 2007, 08:18 PM) From serial communication, you will get bytes.If your data is unsigned, you don't care about the highest 4 bits of the result. Be careful if your result is supposed to be signed, that can be trickier. Ok eaolson, thanks. (my data isn't signed) Things are getting 'more clear' for me. I have another question now. If i send firstly 1 byte (MSB) and then the other byte (LSB), wich VI may i use to join them, i mean, should i store the first one and wait for the second and then join (Join Numbers) or there's a way to join them as they are coming serially? I'm afraid that i'm not being very clear and especific, ok. Thanks. Quote Link to comment
JDave Posted November 2, 2007 Report Share Posted November 2, 2007 QUOTE(RodolfoAcialdi @ Oct 31 2007, 04:00 PM) If i send firstly 1 byte (MSB) and then the other byte (LSB), wich VI may i use to join them, i mean, should i store the first one and wait for the second and then join (Join Numbers) or there's a way to join them as they are coming serially? You cannot join them while they are being transmitted, since you can only transmit bytes. So read both bytes off your serial port then combine them. Quote Link to comment
RodolfoAcialdi Posted November 2, 2007 Author Report Share Posted November 2, 2007 QUOTE(JDave @ Oct 31 2007, 11:28 PM) You cannot join them while they are being transmitted, since you can only transmit bytes. So read both bytes off your serial port then combine them. OK JDave, thanks a lot. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.