{"action":"created","issue":{"url":"https://api.github.com/repos/michaelcheng1991/Golf-Training-Aid-/issues/11","labels_url":"https://api.github.com/repos/michaelcheng1991/Golf-Training-Aid-/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/michaelcheng1991/Golf-Training-Aid-/issues/11/comments","events_url":"https://api.github.com/repos/michaelcheng1991/Golf-Training-Aid-/issues/11/events","html_url":"https://github.com/michaelcheng1991/Golf-Training-Aid-/issues/11","id":92554247,"number":11,"title":"Definitions","user":{"login":"michaelcheng1991","id":7731020,"avatar_url":"https://avatars.githubusercontent.com/u/7731020?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcheng1991","html_url":"https://github.com/michaelcheng1991","followers_url":"https://api.github.com/users/michaelcheng1991/followers","following_url":"https://api.github.com/users/michaelcheng1991/following{/other_user}","gists_url":"https://api.github.com/users/michaelcheng1991/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcheng1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcheng1991/subscriptions","organizations_url":"https://api.github.com/users/michaelcheng1991/orgs","repos_url":"https://api.github.com/users/michaelcheng1991/repos","events_url":"https://api.github.com/users/michaelcheng1991/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcheng1991/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-02T05:41:38Z","updated_at":"2015-07-02T15:19:11Z","closed_at":null,"body":"series shift register (SN\r\nextra digital output pins\r\nmost/least significant bit \r\ndata pin\r\nlatch pin: after calling shift_out() the shift register internally contains new value. To update output pins you must pull LATCH high. This is sometimes called latching on pulsing the latch. Note that it is not enough to hold LATCH high. Data transfer happens on transition from low to high. This is also called rising edge. Code for a led binary counter from 0 to 65535 would look like the following:\r\nint main(void) {\r\n\r\n    for(uint16_t i = 0; i < 0xffff; i++) {\r\n        /* Shift high byte first to shift registers. */\r\n        shift_out(i >> 8);\r\n        shift_out(i & 0xff);\r\n\r\n        /* Pulse latch to transfer data from shift registers */\r\n        /* to storage registers. */\r\n        digital_write(LATCH, LOW);\r\n        digital_write(LATCH, HIGH);\r\n\r\n        _delay_ms(50);\r\n    }\r\n\r\n    return 0;\r\n}\r\nclock pin : Clock is an constant high- low signal used to synchronize data transfer. Each time Clock goes high 2 things happen. Current value in shift register gets shifted left by one. Last bit is dropped out. First bit will be set to current value of Data. to write a byte to shift register this has to happen eight times in a loop. ( the clock pin is toggled once the data has been received )\r\n#define LATCH   B0\r\n#define CLOCK   B1\r\n#define DATA    B2\r\n\r\nvoid shift_out(uint8_t data) {\r\n    for(uint8_t i = 0; i < 8; i++) {\r\n        /* Write bit to data port. */\r\n        if (0 == (data & _BV(7 - i))) {\r\n            digital_write(DATA, LOW);\r\n        } else {\r\n            digital_write(DATA, HIGH);\r\n        }\r\n\r\n        /* Pulse clock input to write next bit. */\r\n        digital_write(CLOCK, LOW);\r\n        digital_write(CLOCK, HIGH);\r\n    }\r\n}"},"comment":{"url":"https://api.github.com/repos/michaelcheng1991/Golf-Training-Aid-/issues/comments/118065401","html_url":"https://github.com/michaelcheng1991/Golf-Training-Aid-/issues/11#issuecomment-118065401","issue_url":"https://api.github.com/repos/michaelcheng1991/Golf-Training-Aid-/issues/11","id":118065401,"user":{"login":"michaelcheng1991","id":7731020,"avatar_url":"https://avatars.githubusercontent.com/u/7731020?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcheng1991","html_url":"https://github.com/michaelcheng1991","followers_url":"https://api.github.com/users/michaelcheng1991/followers","following_url":"https://api.github.com/users/michaelcheng1991/following{/other_user}","gists_url":"https://api.github.com/users/michaelcheng1991/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcheng1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcheng1991/subscriptions","organizations_url":"https://api.github.com/users/michaelcheng1991/orgs","repos_url":"https://api.github.com/users/michaelcheng1991/repos","events_url":"https://api.github.com/users/michaelcheng1991/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcheng1991/received_events","type":"User","site_admin":false},"created_at":"2015-07-02T15:19:11Z","updated_at":"2015-07-02T15:19:11Z","body":"CMOS: complementary metal oxide semi conductor, just a technology to create integrated circuit\r\n\r\nShift Registers\r\n\r\nBCD ( Binary-Coded Decimal): \r\n\r\nRelay: 用較小的電流去控制較大電流的一種“自動開關”。故在電路中起著自動調節、安全保護、轉換電路等作用。"}}