Go Down

Topic: Small Logic Analyzer for Speak & Math (Read 483 times) previous topic - next topic

Z0rb

Hello All,

     I have a need to read a 4 bit bus when a chip select pin goes high and then send that binary information in decimal form out the serial port so I can see what is being sent across the bus. The lines I have to play with are a Chip Select Pin, PDC, and 4 bus bits. The 4 bit bus belongs to a Texas Instruments Speak & Math and I wish to see the commands and rom addresses being sent to the synthesizer. I already converted the PMOS voltages to TTL so the Arduino can read it. I just need a sketch that can help me accomplish this.

I did find this piece of code but fail to understand how it works.

http://playground.arduino.cc/Main/LogicAnalyzer

Can someone explain how this sketch works or perhaps have a better one to use for me needs?

Please advise and thanks

GoForSmoke

You're looking at a lot of AVR assembly there. And no, I'm not going to explain it all because I'm not going to spend hours figuring all the details out.

Basically he is using Port Manipulation (search the Arduino site on that) to read 8 bits at a time and doing whatever he does with those.

YOU only want to read 4 bits at once. With an UNO I can read 6 bits without doing special tricks (because of how some pins are -normally- used, none of the ports has more than 6 bits not used as you can find out) but 4 is less than 6 so you're in luck there!

Do the simpler thing using C/C++ and by the time you have a version of that you will be in a good position to begin to understand Udo's logic analyzer code.

LOL, back in the 80's I was using the graphics chip in my Amiga to process such data en masse using blit operations. But that was then and I didn't have paying work to use it, just experimenting. If you can get the data into a PC you might do the same only bigger and faster.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Riva

Quote
Chip Select Pin, PDC, and 4 bus bits

What is PDC? Is it some form of clock to know when valid data is on the 4 bit bus?
If the data traffic is not excessive could you create a large byte array (memory size permitting) and capture bus data until array is full or CS pin goes low then pump the array out over serial. Maybe using a fast serial speed you could keep up with the data real time. Quick way to read the bus data would be to do direct port manipulation http://www.arduino.cc/en/Reference/PortManipulation
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

Z0rb

GoForSmoke,

       Thanks for your help. I think I will try and take on the programming WITHOUT the AVR assembly. PIC assembly is tough enough for me without having to go the AVR route. Want to try and keep it simple, since I am just playing around and having fun with a Thrift-store toy.

Riva,

        Thanks for the link, that helped a lot. PDC is the Program Data Clock. The traffic is not that great if we consider the Chip Select. Its typically 1 four bit command and 5 data nibbles. So I envision a loop that will look for CS to go high and then monitor a data port for activity and on a PDC high save that data to memory and finally when CS goes low to dump the memory data to the serial port at 115.4.

       The big question now? Is the Arduino quick enough to do all of this with PDC running at around 83Khz?

Thanks Again

GoForSmoke

I don't know how fast your data comes in but data out through serial is slow-mo compared to what the chip is capable of, at least on an UNO.

With a Teensy (Arduino compatible) you can upload at USB speed.

Perhaps the big question is what you need as opposed to can possibly get.
See how fast you can get steady dependable data using regular code just as a first learning step.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Riva

Quote
The big question now? Is the Arduino quick enough to do all of this with PDC running at around 83Khz?

As the data is in small packets you should have little problem reading the data into a buffer and then serial send it when CS goes low/high. Direct port manipulation will save you a lot of instruction cycles compared to reading a pin at a time. I assume the data is dependant on user interaction with the keyboard so as long as the buffer is big enough you can control the flow to some extent by pressing buttons more sedately.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

GoForSmoke

He's going for more than key presses though I don't know how he expects ...

Quote
I wish to see the commands and rom addresses being sent to the synthesizer.


Key presses, in 81 I wrote in interpreter basic on a 4 Mz 8085 S-100 PC a routine to pick up key presses and count loops between. I'd hit 2 keys with index finger and middle finger held back a bit (a piano thing to get 2 notes real close together) and still got 22-25 loops in that slow basic on that slow PC. Normal key presses, I was able to process alphabetic searches as each key was hit in between the hits.

With Arduino I've been polling serial at 115,200, processing the data and still counting micros() spent just waiting for the next available.  :)

Keep your loop() tight and never do much any one time through. Don't write blocking code. Your response time to watch digital data can get down to 1 or 2 microseconds. Add 1 analog read however and you're looking at over 100 micros response time which may get to 8 or less checks per millisecond which is still not exactly slow.

What can I say? I love these things!
I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Go Up