Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] variable/constant input from a PC ?

2004-07-14 by Robert Adsett

At 04:31 PM 7/14/04 +0000, you wrote:
>I'm getting way ahead of myself vs. my understanding of programming
>as I have only started to read the C programming book.
>
>I was wondering if there is a way to connect a uC to a PC via SC
>(serial cable) and input constants ?
>
>What I am thinking about is making a timer.
>I would input a value of say 1 minute to get the program running and
>then later, if I wanted to change the value, I'd like to only input
>that new value from a PALM or PC or something like that.

The short answer is yes.

The longer answer (you knew there was a longer answer) is you need to write 
something at the microcontroller end to have a 'conversation' over the 
serial port to get the new values and store them somewhere (EE 
maybe?).  The microcontroller would parse an input string of something like 
this

a 100

which it would interpret as setting value a to 100.  It would then sore 
that somewhere for the control program in the micro to read.

>I was thinking of using a jumper or switch to tell the AVR to look
>for the new values.

That will work.


>I'm just not sure how easy it would be to use a PC to change some
>values in the micro.

Not difficult, but given that you are just starting I'd suggest that you 
simulate it in a console window on a PC just using getchar and putchar (or 
similar).  The debugging facilities are generally better and you will be 
able to figure out how to deal with the parsing issues more quickly.


>My goal is to create a data logger and to be able to set the time
>between each reading from a PC.  I would have 8 to 10 points that
>would need to be read and each would be a seperate timing value.
>
>This is for a greenhouse and we would want soil moisture sampes only
>a few times a day but humidity and temperature samples much more
>frequently.
>
>I am not sure if this is something that can be done from a existing
>software, or if I also need to learn Visual Basic......

Quite doable.  Add a little local storage and the PC could pick up the data 
once a day or so.  A serial terminal would do just fine for that.  You 
could get fancier but for a simple datalog that gathers data for future 
viewing/analysis that will work just fine.

I've used similar techniques for debugging control SW.


>Also, how-come-is-it that the more I learn, the father away my goal
>seems to get ?   When I started, it was really simple !

Why do forests appear more complex when you get close enough to see the 
individual trees ;)


Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.