//
// pict13c.c // // Implementation of the PICT13.ASM program in Easy Pic 'N // bit rotation demo. This takes a few short cuts - probably // not faithful to the original, but does the same job. // Note that the pause function is not really necessary but // done mostly to get a subroutine working. In addition, this // program satisfies the example for pict12.asm and // pict8.asm in the book. // // Using '84 on a board (simple solderless breadboard with // 16F84 on it) and Peter Anderson's include file with // port/bit definitions (defs_f84.h available at www.phanderson.com) // Settings: // 4Mhz resonator (not important) // All Port A inputs use external pullups (resistor SIP used) // Port B outputs tied to a LED array (Radio Shack has 'em) // Port A inputs tied to ground through four switches // Port A inputs not used in this example. #case #include <16f84.h> #include// defines registers and bits #fuses xt,nowdt,put,noprotect #use delay(clock=4000000) // required to use the delay_ms(time) function // 40000000 is the xtal speed void pause (long t); // predeclare pause function void main(void) { int shift=73; // put in a bit pattern TRISB=0x00; // make portb all outputs PORTB=0; bit_clear(STATUS,0); // clear carry flag // anyone know a more 'c' like // way of doing this? while(1) { PORTB=shift; // show bit pattern rotate_left(&shift,1); // rotate 1 to the left pause(500); // pause so you can see it } } void pause(long t) { delay_ms(t); }