'State machine and EEPROM 24LC...'
|part 0 2280 bytes
!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
I'm developing a project in wich a
PIC 16F84 acquires pressure and flow parameters of a water pipe and then has to
control, through a TRIAC, the power delivered to a water pump based on some
calculations on the parameters acquired. The data acquired and the pump power
level need to be transmitted via RF link and showed to a LCD display module
based on another PIC that manages also a keyboard to allow some manual control
over the whole stuff.
Well, here is the problem: I'm
thinking to implement the logic with a "state machine" technique
instead of making tons of SW logic; this solution allows to implement a sort of
multitasking in which the several tasks like "data acquisition from
sensors", "driving of the TRIAC", "trasmitting data to the
display" and "receiving comands from the keyboard" could be
managed all in parallel execution (not truly but enough close). The disadvantage
of this approach is the EPROM memory area needed to store the state matrix: the
total size is "number of inputs" x "number of states". So i
decided to go with external 24LC... EEPROM to store the matrix but the problem
is HOW TO PROGRAM IT ?
I know 24LC... is a I2C device, thus
my PIC programmer nothing can do with it. Is there any brilliant solution for
filling the data into the memory different from spending money for an expensive
EEPROM programmer ?
Thanks in advance for your
>nothing can do with it. Is there any brilliant solution for filling the
>data into the memory different from spending money for an expensive EEPROM
>programmer ? Thanks in advance for your help.
visit page http://www.carmacon.com and ask the webmaster there about "Chippey."
It's a handy little gadget that plugs into your parallel port to read/write
I2C EEPROM devices. No power necessary.
Been using it for years. Works great.
Andy Kunz - Montana Design - 409 S 6th St - Phillipsburg, NJ 08865
Hardware & Software for Industry & R/C Hobbies
"Go fast, turn right, and keep the wet side down!"
'Grif' w. keith griffith
At 14:30 11/29/97 -0500, you wrote:
>>nothing can do with it. Is there any brilliant solution for filling the
>>data into the memory different from spending money for an expensive EEPROM
>>programmer ? Thanks in advance for your help.
Sorry about the off topic reply,,, but if you've messed with the BS-2,
scott edwards has some sample code that will fill the bill very nicely.
His (scott's) datalogger proto board uses two eeproms, serial and has a
nicely thought out sample of a data logger sample program that does the
job. I'd guess the sample code is on the parallax board. This all assumes
you have a basic stamp II of course ;-)
|Of course. Simply use the Microchip application notes on driving the
24LCxx devices and create a PIC which programs them - and have it accept
commands via RS232 so then you have an ultra-low-cost EEPROM programmer.
I don't understand why you need so much memory for a state machine.
Normally you need only a byte or two to store the state number (a state
machine with over 256 finite states would have so much code I don't see
how you'd implement it in a 16F84). Plus a byte or two to store
state-associated flags. You start at state 0 and then as events occur
you move to state x, state y etc. You certainly don't need an n-input X
m-state array under normal circumstances.
In two bytes I have implemented state and status for quite a complex
dual-triac zero-crossing temperature controller which also had a control
keypad, dual LED displays and a Dallas DS1820 temperature sensor. If
your project is much more complex, are you sure your code will fit into
'State machine and EEPROM 24LC...'
|Hmm. If there are 4 inputs and 12 states, then encoding the state number
as 4 bits implies that the entire machine state at any given time is
encoded as 2 bytes (4 nibbles, one for each channel). (i.e each of the
four input channels is independently in state 's'). Of course, what you
are intending to do, I presume, is to look up the state transition table
from eeprom. Again, though, if there are 12 states, then each next state
surely is also a number from 1-12 (or 0-11 if you prefer). This implies
that such a lookup table would be 12 nibbles or six bytes, and isn't the
transition table the same for each input?. Sure, each input channel is
at any time in an independent state from any other input channel, but
the transition table is shared by all input channels as they are all
processed the same.
I may have misunderstood what you need to do but on the surface this
seems to be plausible. Of course, if you need to store data at each
point in the state transition matrix, you need more memory. But normally
this isn't necessary - in your case it sounds like a classic 'if
negative transition, and in state 5, go to state 6' etc.
It is germane to point out that randomly accessing EEPROM is quite slow
because you need to clock in the full address (I am assuming you are
intending to use an I2C device such as the 24LC16B. Even using a 400KHz
clock rate, this is still some 30 or so clock cycles, from memory (oops,
no pun intended). That would imply up to 100 microseconds per random
access, which might be an issue. Of course, you can be servicing
interrupts etc. while setting up the access.
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- New search...