Guest User

Untitled

a guest
Jul 20th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1.  
  2. // Write the disable protection code, to allow writing
  3. void disable_protection()
  4. {
  5.  
  6.   turn_on(OE);
  7.   turn_on(WE);
  8.   turn_off(CE);
  9.   io_output();
  10.   s_byte(0xAA, 0x5555);
  11.    turn_off(CE);
  12.   s_byte(0x55, 0x2AAA);
  13.    turn_off(CE);
  14.   s_byte(0x80, 0x5555);
  15.    turn_off(CE);
  16.   s_byte(0xAA, 0x5555);
  17.    turn_off(CE);
  18.   s_byte(0x55, 0x2AAA);
  19.    turn_off(CE);
  20.   s_byte(0x20, 0x5555);
  21.   io_input();
  22.   turn_on(CE);
  23.   Serial.print("The protection has been removed");
  24.  
  25. }
  26. // This is a special function, which allows writing a byte without checking if the write is done yet.
  27. void s_byte(uint8_t data, uint16_t addr)
  28. {
  29.   // When adding the third shift register, this code will be changed
  30.   aanstaanden = addr;
  31.   shift_a_byte(aanstaanden);
  32.   put_io(data);
  33.  
  34.  
  35.   turn_off(WE);
  36.   delayMicroseconds(1);
  37.   turn_on(WE);
  38.   turn_on(CE);
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment