Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "rims.h"
- /* This is a sample program. You can save/compile/run it,
- modify it first, or just load a different program. */
- /* Sets B0 to 1 as quickly as possible when A0==1 and A1==0*/
- /* Note that A0 - A7 can be set by clicking the switches to
- the left, and B0 - B7 can be viewed as LEDs to the right
- (green corresponds to '1', red to '0'). */
- volatile unsigned char TimerFlag=0; // ISR raises, main() lowers
- void TimerISR() {
- TimerFlag = 1;
- }
- void DoTime(int time) //myFunction
- {
- TimerSet(time);
- TimerOn();
- while(!TimerFlag){}
- TimerFlag = 0;
- }
- char elBoolo = 1;
- char counter = 0;
- void main()
- {
- while (1) {
- while(A0 && !A1)
- {
- B = 0xFF;
- DoTime(1000);
- B = 0;
- DoTime(1000);
- }
- while(A1 && !A0)
- {
- B0 = 1;
- while(elBoolo == 1)
- {
- B = 1 << counter;
- counter++;
- if (counter == 7)
- {
- elBoolo = 0;
- }
- DoTime(500);
- }
- while(elBoolo == 0)
- {
- B = 1 << counter;
- counter--;
- if (counter == 0)
- {
- elBoolo = 1;
- }
- DoTime(500);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement