Logic Help Please

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: Logic Help Please

Post by Gorgon »

Originally posted by jimandy:
Gorgon-
So, remember this the next time you need 'glue logic' in a design, at least if you have loads of old eproms on the shelf.
And a real challenge is to make a sequential logic circuit with an EPROM. I fiddled with this awhile back using a clocked 8 bit latch in between the output and selected inputs of the EPROM. Programming done in Excel to figure out what byte should give the next byte. Sort of a finite state machine gizmo.
Hi Jimandy,
Did you succeed in this?
I think reuse of all the old discarded components of yesterdays electronics is the next hot topic in the DIY community. It's probably the only components we can get and see. :)

TOK ;)
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: Logic Help Please

Post by Newz2000 »

Originally posted by Gorgon:
Serious question, how many knows what a state machine is? And how to implement one?
I bet nobody think about that every time they use a microcontroller? As far as I know there is one(at least) of those in each controller.

I think I'm getting too old :)
I know what one is. I implemented my first one based on instructions from you and philba, actually.

I don't think it's necessary to have one in each microcontroller though. The code I just wrote for the dome-light project was very procedural. For example, if you start to play a sound the program halts until the sound is done. Then it goes on to the next step.

Maybe I'm thinking of a higher-level state machine and there is a state machine lower in the hardware, if so, they I'm not in the know.
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: Logic Help Please

Post by Gorgon »

Hi Matt,
Sorry, I just went rambling on. What I ment was that every microcontroller is based on a state machine in the CPU/ALU. Very hidden from the normal user, but still. :D

TOK ;)
(Still Norwegian)
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
Colinr
Posts: 33
Joined: Wed Oct 23, 2002 1:01 am
Location: UK
Contact:

Re: Logic Help Please

Post by Colinr »

Paul

you need to connect all of the address lines to 0V except the line that you are testing. or they will foat high.

also try programming the eprom with a simple pattern that is easy to see what is happening a simple 1 to 1 relationship will be a start.

eg
address 0 data 0x01
address 1 data 0x02
address 2 data 0x04
address 4 data 0x08
address 8 data 0x10
address 16 data 0x20
address 32 data 0x40
address 64 data 0x80

this will light 1 LED for each address line that is puled high
ie if address line 0 os pulled hi then the LED on data line 0 will light
and if address line 1 is pulled high then the led on data line 1 will light.

Note the pattern shown above will only work with one address line at a time.
note numbers prefixed in 0x are hexidecimal

Colin


colin
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: Logic Help Please

Post by Newz2000 »

Originally posted by Gorgon:
Hi Matt,
... What I ment was that every microcontroller is based on a state machine in the CPU/ALU. Very hidden from the normal user, but still. ;)
Actually, I suspected you meant something along those lines which is why I even replied. I figured there was something down there I didn't know about.

Is there two definitions of state machine or does the same concept apply regardless of if is done in hardware or firmware?
paulsantangelo
Posts: 75
Joined: Mon Aug 29, 2005 1:01 am
Contact:

Re: Logic Help Please

Post by paulsantangelo »

Hey Gorgon:

I will try these, do you think a bit might be on in the program? I may have screwed things up there, after address 8f on 90 forward I left everything as FF, I didn't think it mattered!

-paul
jimandy
Posts: 572
Joined: Sat Dec 04, 2004 1:01 am
Location: Birmingham AL USA
Contact:

Re: Logic Help Please

Post by jimandy »

I used state machine logic for several small control board projects. At the design phase I found state diagrams with their circles and arrows, a great way to visualize the logic. Using a white board I could better "brainstorm" the process with my team and more quickly redefine the actions of the machine. From the diagrams it was then a fairly easy matter to translate the state transitions into the required EPROM code using Excel. Of course, this was before the advent of the really cheap microcontrollers and programmers and, besides, I was too lazy to master a new programming language after forgetting all the old 6800 assembler from years earlier.

One project (designed but never finished) was a controller for a cross point switcher with 7 segment displays to interconnect all the audio paths in highly componentized home entertainment system. I still want to build that some day.
"if it's not another it's one thing."
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: Logic Help Please

Post by Gorgon »

Originally posted by paulsantangelo:
Hey Gorgon:

I will try these, do you think a bit might be on in the program? I may have screwed things up there, after address 8f on 90 forward I left everything as FF, I didn't think it mattered!

-paul
Hi Paul,
To be certain program all databytes from 0x81 to 0xFF to 0x00. If you have connected the address lines from A8 to A15 to 0v, you can't address anything above 0xFF.

TOK ;)
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
paulsantangelo
Posts: 75
Joined: Mon Aug 29, 2005 1:01 am
Contact:

Re: Logic Help Please

Post by paulsantangelo »

OK, Done! I try again tonight!
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Logic Help Please

Post by philba »

Originally posted by Matt Nuzum:


Is there two definitions of state machine or does the same concept apply regardless of if is done in hardware or firmware?
The concept is the same though different implementation can take you in vastly different directions. Basically a state machine has a set of inputs, a table (or set) of transitions based on current state + inputs and a set of outputs. The nice thing is you can make the transition table just be data and then the state machine is simple to implement in code. important when doing assembler...
paulsantangelo
Posts: 75
Joined: Mon Aug 29, 2005 1:01 am
Contact:

Re: Logic Help Please

Post by paulsantangelo »

OK, Done! I try again tonight!
paulsantangelo
Posts: 75
Joined: Mon Aug 29, 2005 1:01 am
Contact:

Re: Logic Help Please

Post by paulsantangelo »

I set adress 0x00000081 0x0000ffff to 00.

That should do it!
paulsantangelo
Posts: 75
Joined: Mon Aug 29, 2005 1:01 am
Contact:

Re: Logic Help Please

Post by paulsantangelo »

Colin:

I'm going to try Gorgan's suggestion first, becuase to sr=crewed up the programming. It kind of makes sense if all the extra addresses are filled with values of 0xFF and associated pins (A8 - A15) the pins are kept low, who knows what would happen, but just in case can we go over your suggestion?

address 0 data 0x01
address 1 data 0x02
address 2 data 0x04
address 4 data 0x08
address 8 data 0x10
address 16 data 0x20
address 32 data 0x40
address 64 data 0x80

Address 0 is byte 1 which you think I need to fill with 0x01 or

Address 0 is byte 01 should be filled with 0x01
Address 1 is byte 02 should be filled with 0x01

I understand the HEX data in the address space is the converted binary code you want on the output.

So this is what I'm working with

Pin Address Data (your idea)
A0 1 0x01
A1 2 0x01
A2 4 0x01
A3 8 0x01
A4 16 0x01
A5 32 0x01
A6 64 0x01
A7 128 0x01

Is that correct?

-Thanks
paulsantangelo
Posts: 75
Joined: Mon Aug 29, 2005 1:01 am
Contact:

Re: Logic Help Please

Post by paulsantangelo »

Colin, Never mind, I just ran your data through a hex to binary converter. I see what your talking about. If the reprogramming doesn't take care of it, I will make a new chip.
paulsantangelo
Posts: 75
Joined: Mon Aug 29, 2005 1:01 am
Contact:

Re: Logic Help Please

Post by paulsantangelo »

Colin:

I wrote the chip anyway, just in case, but I shifted your address scheme Gorgon had me start with Address 00000001, so I started there instead of 00000000. I wonder what pin is at address 00000000?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests