NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Receiving the Temp Sensor Input via Serial
February 23, 2011 by Twarter369 |
Hello all. I am having trouble getting a piece of code to work. In essence, what I want to do is have the MCU send the raw ADC data back to my c++ via the serial conn. The flow of the program goes like this: A user clicks a button, the program sends a "3" along the serial port, the MCU interprets this as the command to take the temp and send it back along the serial. The c++ program starts listening on the serial port for communication and waits to update the temp label with the incoming data. Does anyone have a c++/MCU example of this direction of communication? I was going to pick apart the digital scale code to see how it is handled in that project. Are there any others you guys can recommend? |
---|---|
February 23, 2011 by 6ofhalfdozen |
Twarter, While not exactly the same thing, I did something similar in my VB controling LEDs test. I believe my VB code is shown in that post and there are references to a post by Nerdful on the mcu parts. Search for VB posts in the forum and it should come up. i know C++ is not VB, but you should be able to pick apart my code and translate into C++ pretty easily. The mcu side is the mcu side, and you would need to change the "turning on LED" into firing the ADC and returning the data similar to what the NK does for the temp sensor project. That should give you a rough idea of where to go. |
February 23, 2011 by Noter |
Visual C++ 6.0 example ...
|
February 23, 2011 by Noter |
Oops - this is probably the important piece ... comport.h
|
February 23, 2011 by Twarter369 |
Wow, that is a lot to digest. Thanks guys. I believe I may have found what I was looking for in the docs. Here is a sample of the setup for my com port
I should be able to use the SerialDataRecieved Event Handler, which I would add directly before sending the "3"....I hope, like this. I will report back with my results or any other questions that come up! |
Please log in to post a reply.
Did you know that you can build a digital read out (DRO) for a lathe or milling machine? Learn more...
|