I am using a PIC16F616. I can't get the HWPM to work. I threw in the Toggle command for a channel to check if the processor is operating. PortC.5 is going hi/lo.
Any ideas?
Code:'**************************************************************** '* Name : UNTITLED.BAS * '* Author : [select VIEW...EDITOR OPTIONS] * '* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 4/3/2009 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** INCLUDE "modedefs.bas" OPTION_REG.7 = 0 'Pull Ups enabled TRISA.2=1 TRISC.0 = 1 TRISC.1 = 0 TRISC.2 = 0 TRISC.3 = 1 TRISC.4 = 0 TRISC.5 = 0 '0 Digital 1 Analogue ANSEL.7=0 ANSEL.6=0 ANSEL.5=0 ANSEL.4=1 ANSEL.3=0 ANSEL.2=0 ANSEL.1=0 ANSEL.0=0 ADCON0.7=1 'Right Justified ADCON0.6=0 ''Voltage reference is VDD ADCON0.5=0 'Turns on AN4 to analogue ADCON0.4=1 ADCON0.3=0 ADCON0.2=0 'HPWM DEFINES DEFINE CCP1_REG PORTC DEFINE CCP1_BIT 1 'Hpwm 2 --> portc.1 DEFINE CCP2_REG PORTC DEFINE CCP2_BIT 2 'Hpwm 1--> portc.2 Define ADC_BITS 8 ' Set number of bits in result Define ADC_CLOCK 3 ' Set clock source (3=rc) Define ADC_SAMPLEUS 50 ' Set sampling time in uSec Switch var PortA.2 ' FF var PortC.0 FrontOut var PortC.1 RearOut var PortC.2 GS var PortC.3 Watch var PortC.5 HPWM 1,127,400 HPWM 2,127,400 Loop: If Switch = 1 then Toggle Watch pause 100 endif goto Loop



<hr>

Bookmarks