PDA

View Full Version : noobie question



02GF74
- 29th November 2006, 11:08
I have bought a USB PIC prgrammer and want to verify that I have programmed a 16F676 device successfully.

So my program initially was to toggle one line on port C and device configrued to use internal osciallator.

that didn't work so I removed the int. osc code and wired up a 10 MHz crystal and capacitors but no difference - I'm pretty sure the device needs to be configured so it knows there is an external clock souce but ain't figure that one out yet - which may explain why that failed too.


So in short, in both cases the device did not do what I expected so I have a plea for some sample code as follows:

1. configure device to use internal oscillator
2. config device to use external crystal
3. some code to toggle a line on Port C at say every second so I can measure using DVM.

I'm going trhough the device spec. sheet but is it rather hard going - any links to beginners programming guide, idealy specific to 676 device would be muchly appreciated. :)

Archangel
- 29th November 2006, 18:47
Hi 02GF74,
this should get you started, if any of these cause the compiler to hang, just comment it out.
JS



ADCON1 = 7 'Disable A/D converter
CMCON=7 ' DISABLE ANALOG ON 676
@ DEVICE PIC16F676,HS_OSC
@ DEVICE PIC16F676, WDT_OFF
' Watchdog Timer
@ DEVICE PIC16F676, PWRT_ON
' Power-On Timer
@ DEVICE PIC16F676, MCLR_ON
' Master Clear Options (Internal)
@ DEVICE PIC16F676, BOD_OFF
' Brown-Out Detect
@ DEVICE PIC16F676, LVP_OFF
' Low-Voltage Programming
@ DEVICE PIC16F676, CPD_OFF
' Data Memory Code Protect
' Set to CPD_OFF for Development Copy
' Set to CPD_ON for Release Copy
@ DEVICE PIC16F676, PROTECT_OFF
' Program Code Protection
' Set to PROTECT_OFF for Development Copy
' Set to PROTECT_ON for Release Copy
http://ww1.microchip.com/downloads/en/DeviceDoc/40039D.pdf