Go Down

Topic: Problem with "sniffing" on Shift Register's SerIN & Clock (Read 3269 times) previous topic - next topic


Feb 14, 2014, 09:32 am Last Edit: Feb 14, 2014, 06:59 pm by surumadurum Reason: 1
I am currently working on hacking an old snack vending machine.
The motor matrix for the dispense is controlled by a 5890 and a 5842, both regular shift registers.
(the 2 form a cascade)

I wanna keep using the existing vending machine's controller board with the motor drivers.
Now the first step is intercepting the signals sent to the shift registers by the original microcontroller in order to later replace it by an arduino and do a kind of "capture and replay".

When I connect a LogicAnalyzer(OLS/Arduino), i get nice results(see picture), but somehow my Arduino sketch, which should just
decode the sent signal.

The arduino console output for the same signal as on the picture is
Code: [Select]


...which just can't be right...

Here's my code:
Code: [Select]

#define CLCK 2
#define DATA 3
#define OE   5

volatile int master_count = 0; // universal count

volatile uint16_t in_buffer =0;

void setup() {
 pinMode(DATA, INPUT);
 pinMode(OE, INPUT);

void loop() {
      master_count = 0;
      in_buffer = 0;

 attachInterrupt(0, interrupt, RISING);  
 // interrupt 0 digital pin 2 positive edge trigger
       *in_buffer =0;

void interrupt() {
       boolean read = digitalRead(DATA);


//function that also prints leading zeros
void printBIN(volatile uint16_t* binary)
 for(int i=15;i!=-1;i--)
   else Serial.print('0');

I was thinking that it might be a timing issue, but the shift register is being sent to with about 100khz, and the arduino is running at 16mhz, so between to edges on the clock signal there is space for about 160 instructions on the Arduino, which should be fine, rihgt?

Thanks, Robert



I think you are displaying the buffer when all is gone shouldn't it be 14 here
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!


I think you are not actually sniffing the correct value. Try just printing the binary value of your buffer with a normal serial print command.

Go Up