03-08-2014 01:12 PM
Hi
I'm building a program which send a command to microcontroller, for instance: send number '1' --> channel ADC 1 OFF. And there is my problem: I have 4 channels, which measure ADC voltage on input. I really don't like soldering (:D) so I'd like to turn praticular channel on/off in my program by sending a command to microcontroller. 4 channels, 2 different status -> 16 different combinations. Have you any idea how simplify this process? Maybe I should send a xxxx numeric (x - refers to state 1 OFF, 2 ON, example '1378', channel 1 ON, channel 2 ON, channel 3 ON, channel 9 OFF), and load it to frame in microcontroler? Byte UDR, which is in charge of reception, have 8 bits, so I have to send '1378' one number by one and I can't do it. Any ideas? 🙂
03-08-2014 01:24 PM
03-08-2014 01:30 PM
But how I can transmit boolean values via VISA write? On the input is string only.
Here it is, my inefficient solution:
03-08-2014 01:42 PM
03-08-2014 01:47 PM
03-08-2014 01:49 PM
What is 'U8'? Sending 4 bytes (0,1), will complicate situation - I can't recognise if it is channel 1 or 2 etc, because my Atmega will read only 1 byte and then another byte. It will be neccessary to use separator or something like that
03-08-2014 01:51 PM - edited 03-08-2014 01:57 PM
Ok, seems good. But how I can write information about channel and state to 1 byte array? Array of 8 booleans? Array of booleans will lead to string conversion error
03-08-2014 01:56 PM
03-08-2014 01:59 PM
You're smart, thanks! But there is problem in conversion of array of bytes to string...
03-08-2014 02:01 PM
And of course value 0111 can't be converted to numeric