This is a GR peach project demonstrating shift registers 595 and 165

Dependencies:   Arduino mbed

Files at this revision

API Documentation at this revision

Comitter:
RahulSitaram
Date:
Sat Dec 03 07:17:34 2016 +0000
Commit message:
Shift registers with Grpeach

Changed in this revision

Arduino.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
shitreg.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Arduino.lib	Sat Dec 03 07:17:34 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/RahulSitaram/code/Arduino/#d0b32a4209f0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 03 07:17:34 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shitreg.cpp	Sat Dec 03 07:17:34 2016 +0000
@@ -0,0 +1,69 @@
+#include "mbed.h"
+//#include <bitset>
+#include "arduino.h"
+
+//using namespace mbed::mbed;
+
+//DigitalOut lat(P8_11);
+//DigitalOut dat(P8_13);
+//DigitalOut clk(P4_4);
+Serial pc(USBTX, USBRX); // tx, rx
+DigitalOut pins[1][3] = {{P8_11,P8_13,P4_4}};
+DigitalIn ser(P2_14);
+DigitalOut clk_inh(P4_5);
+DigitalOut clk_2(P4_7);
+DigitalOut SH_LD(P4_6); 
+
+int delay_time;
+int i;
+uint8_t init;
+uint8_t data_read;
+void shift(uint8_t data, int delay_time,int row_no){
+    DigitalOut lat = pins[row_no][0];
+    DigitalOut dat = pins[row_no][1];
+    DigitalOut clk = pins[row_no][2];
+    clk = 0;
+    dat = 0;
+    lat = 0; 
+    SH_LD = 1;
+    clk_inh = 1;
+    clk_2 = 1;
+    data_read = 0x00;
+    init = 0x80;
+    
+    for(i=0;i<8;i++){
+        dat = data & (init>>i);
+        clk = 1;
+        clk = 0;
+        }
+    lat = 1;
+    lat = 0;
+    
+}
+
+uint8_t shift_par(int clk_time, int load_time){
+    SH_LD = 0;
+    wait_us(load_time);
+    SH_LD = 1;
+    wait_us(load_time);
+    data_read = (data_read<<1)|ser;
+    clk_inh = 0;
+    
+    for(i=0;i<8;i++)
+    {
+        data_read = (data_read<<1)|ser;                                 
+        clk_2 = 0;
+        clk_2 = 1;
+        
+    }
+    
+    return data_read;
+    
+    }
+
+int main() {
+    
+    shift(0x4F, 0, 0);
+    wait_ms(500);
+    pc.printf("%c", shift_par(0,0));
+}
\ No newline at end of file