11-28-2007 08:58 AM
Sorry for my late reply.
I have attached a typical string into my control and saved the VI.
1. The length of my string is 2.
2. I am afraid I do not know. This would depend on what delimiters Visa Read VI adds itself (i think.). However, I cant seem to find info on this.
3. Not quite certain what you are asking. I am sending an AC signal to COM1. Your answer might be the whole range of value between 0 - 2^16 (0-65536).
4. The output I would like is U16 values.
Hope this helps you, in giving me some advice.
Thanks for your help.
Regards
Alex
12-04-2007 08:05 PM
No, you did not. After your control contains the string, you need to make the current value the default before saving, else the values will be lost.
bogiasac wrote:
I have attached a typical string into my control and saved the VI.
01-14-2008 10:53 AM
Sorry for my really late reply.
Hope this has solved the problem.
Please have a look.
Regards
Alex
01-14-2008 11:25 AM
It seems you are switching specifications around here.
Your input ( x06D1 or b0000011011010001) no longer matches the desired bit pattern 001xxxxx101xxxxx, so you should get zero while in fact you are getting 209. Also, your code can only properly handle strings of lenght=2. Is that all you want?
Please tell us what output you expect.
01-14-2008 11:59 AM
Thanks for your reply altenbach.
Sorry for the mix up. I mentioned in a previous post that:
… bytes that start with 000 represent MSB and Bytes that start with 100 represent LSB.
Thus:
MSB: 0-0-0-d9-d8-d7-d6-d5
LSB: 1-0-0-d4-d3-d2-d1-d0
The output I would expect is any decimal number between 0-1024. Hope this is of assistance.
Handling a string length of 2 is what I want.
Again sorry for the mix-up.
Regards
Alex
01-14-2008 12:36 PM
01-14-2008 12:51 PM - edited 01-14-2008 12:51 PM
01-14-2008 02:14 PM
Thanks for spotting that altenbach.
The problem was in the PIC code. What was happening, was that I was ORing the ADC_LOW variable using b100. However the values I was ORing were data values, thus when ORing I could get any of the following values b111, b110, b100.
WRONG - U2TXREG = (char) ((usart_txbuf[usart_tx_tail]>>6) | 0x80);
RIGHT - U2TXREG = (char) (((usart_txbuf[usart_tx_tail]>>6) & 0x1F) | 0x80);
I have made the current value the default and saved the VI.
My question still remains how would I clip one char if the pattern does not much?
Again I am sorry for all the mix up.
Regards
Alex
01-14-2008 02:33 PM
If your string is only 2 characters, this will not do anything useful, otherhwise just do a string subset of lenght 2 starting with the second character of the original string.
bogiasac wrote:
My question still remains how would I clip one char if the pattern does not much?
01-17-2008 10:34 AM
Thanks for your reply altenbach.
Ideally my string would be a large number of characters and I would have to distinguish the MSB and LSB in each of those and concatenate them.
I am however, having trouble using the 'Bytes at Port' property node (the data I get is sent via serial), thus I am currently reading 2-bytes at a time, which works fine for the time being.
Once I resolve the issue with the 'Bytes at Port', I will into string manipulation more intensely.
Thanks again for your help.
Alex