09-19-2020 10:46 AM
I am trying to Send DI and AI states / Receive DO and AO states through a microcontroller Serial port ... the microcontroller sends data at 100ms intervals.
When I run this code the AI and DI states do not update based on user inputs. It only updates once during start of run.
What is wrong ?
Solved! Go to Solution.
09-19-2020 01:13 PM
Here are some suggestions (partly based on missing specifications on your part or lack of understanding by me):
Bob Schor
09-19-2020 06:17 PM
I'm not sure where Bob is getting FPGA from. I don't see anything in the post or VI that screams "FPGA". But here are a few tips:
1. Go watch this: VIWeek 2020/Proper way to communicate over serial
2. Get rid of the Feedback Node. That is what is keeping your outputs constant.
3. Turn your AI values into an array, do the scaling, and use Array To Spreadsheet String to form your comma delimited string.
4. Use Scan From String to parse the read data. You can get all of your values in a single node.
09-19-2020 08:31 PM
@crossrulz wrote:
I'm not sure where Bob is getting FPGA from. I don't see anything in the post or VI that screams "FPGA".
Hs! Was fooled by the Frame Sequences. I have only recently been introduced to FPGA code, where Sequences Rule, so that plus the reference to "Hardware Simulation" led me astray ... I apologize for my carelessness.
Bob Schor
09-20-2020 02:06 AM
@crossrulz
Looks I have got the right answers !
Understood. So the "Bytes at port" is to LabVIEW as "Goto" is for C language. Will stay away from it. Maybe in your linked video you explain that later why is it so ? Anyway I could see the video is almost an hour as you were responding to questions in-line. Will see that later.
In the meanwhile tried to open the Github examples but they are LV2019. I am a dinosaur stuck with LV2017.. can you please post a suitable compilation ?
Thanks !!
09-20-2020 05:12 PM
@MogaRaghu wrote:
In the meanwhile tried to open the Github examples but they are LV2019. I am a dinosaur stuck with LV2017.. can you please post a suitable compilation ?
You're lucky I still have a 2016 version zipped up. I think I used maps in one of the examples, which were new to 2019. But here you go anyways.
09-21-2020 12:41 AM
09-21-2020 05:22 AM
@MogaRaghu wrote:
Understood. So the "Bytes at port" is to LabVIEW as "Goto" is for C language. Will stay away from it. Maybe in your linked video you explain that later why is it so ? Anyway I could see the video is almost an hour as you were responding to questions in-line. Will see that later.
Hah! That's a very good way of putting it! Yes, Bytes at port, sequence structures and Local variables are like 'goto', they're Tools that's good in the right _rare_ circumstance.
09-21-2020 05:57 AM
@Yamaeda
Thanks.
While we agree that Bytes at Port is bad, can I know why is it bad ? Does it end up locking up the CPU resource ( which I don't think is the case as the code is responsive normally ) or what is the harm that it actually do ?
09-21-2020 06:08 AM - edited 09-21-2020 06:09 AM
Hi Moga,
@MogaRaghu wrote:
@Yamaeda
While we agree that Bytes at Port is bad, can I know why is it bad ?
You don't need it in most cases!
You can use BytesAtPort to check for any messages at all, when the device sends them only very seldomly: this way you don't need to handle TimeOut errors of VISARead, but can check for ">0" bytes received…