Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by Erik ( 14 years ago )
#include "pic.h"
char pinStatus = 0;
void delay(unsigned int j){
while(j>0){
j--;
}
}
void setPin(char p,char v){
if(v==0){
pinStatus = pinStatus & (~ (0b000001<<p));
} else {
pinStatus = pinStatus | (0b000001<<p);
}
GPIO = pinStatus;
}
void shiftSet(char v){
setPin(2,0);
setPin(0, v);
setPin(2,1);
}
void clearShift(){
setPin(1,0);
setPin(1,1);
}
int main(){
TRISIO = 0;
GPIO = 0;
while(1){
clearShift();
shiftSet(1);
shiftSet(0);
shiftSet(1);
shiftSet(0);
shiftSet(1);
shiftSet(0);
shiftSet(1);
shiftSet(0);
delay(32000);
clearShift();
shiftSet(0);
shiftSet(1);
shiftSet(0);
shiftSet(1);
shiftSet(0);
shiftSet(1);
shiftSet(0);
shiftSet(1);
delay(32000);
}
}
Revise this Paste