SQUARE 1 ELECTRONICS
UPDATE - Pulser - Easy Step'n

The pulser described on pages 36 through 44 is based on the PIC16C711 which is no longer available. A newer 18-pin device with A/D and pin-for-pin compatibility is the PIC16F818. Changing the code to work with the F818 is easy. Only fifteen lines of code must be changed. I will refer to the lines of code requiring changes by line number.

4    list    p=16f818
5            __config  h'3f63'
13   adresh  equ   0x1e
14   adcon0  equ   0x1f
16   count   equ   0x20
17   ncount  equ   0x21
18   mcount  equ   0x22
19   ad_ct   equ   0x23
20   rate    equ   0x24
21   temp_w  equ   0x25
22   temp_s  equ   0x26		
39   movlw   b'00000001'   ;inputs/outputs
43   movlw   b'00001110'   ;port A, bit 0 analog input AN0
44   movwf   adcon1        ;   bits 4,3,2,1 digital I/O
82   movf    adresh,w      ;conv complete, get A/D result 
The F818 configuration register is different. The F818 has a 10-bit A/D converter which is used here in the 8-bit mode. The most significant 8 bits are in the adresh register when the conversion is complete. The F818 A/D gives us the option of having only one A/D input at AN0. With the C711, the minimum was two analog inputs, AN0 and AN1 (AN0 was used and AN1 was wired to ground). The general purpose file registers (RAM) start at 0x20 instead of 0x0c.

| Home |

Last updated February 22, 2008 Square 1 Electronics