View Full Version : Hpwm On 16f873
k-hirayama
- 14th February 2008, 16:41
HI.
I'm using pbp2.46 with MCS.
I'trying to LED dim controll.
like bellow program,
No complie error and ICD error.
but, LED dose not work.
What's wrong at this program.
DEFINE LOADER_USED 1 ' uses a bootloader
define OSC 20 ' *** SET THE CORRECT SPEED ***
DEFINE CCP1_REG PORTB
DEFINE CCP1_BIT 0
DEFINE CCP2_REG PORTB
DEFINE CCP2_BIT 1
DEFINE CCP3_REG PORTB
DEFINE CCP3_BIT 2
ADCON1 = 7
N1 var byte : N2 VAR BYTE :N3 VAR BYTE
trisa.1 = 1
trisa.2 = 1
trisa.3 = 0
trisa.0 =0
trisb =0
main1:
ptn1:
porta.3 = 0
for N1 = 1 to 254 'ptn1
HPWM 1,n1,1000
HPWM 2,n1,5000
HPWM 3,n1,5000
if porta.2 = 1 then
porta.3= 1
pause 500
goto ptn2
else
endif
next N1
skimask
- 14th February 2008, 17:15
DEFINE CCP1_REG PORTB
DEFINE CCP1_BIT 0
DEFINE CCP2_REG PORTB
DEFINE CCP2_BIT 1
DEFINE CCP3_REG PORTB
DEFINE CCP3_BIT 2
Look at the '873 datasheet.
How many CCP modules does the '873 have?
What pins are those modules assigned to?
k-hirayama
- 14th February 2008, 22:07
Hi
thank you always.
Sorry that I do not understand about ccp.
usealy I see only about pin diagram in datasheet, so not know deeply understand about a PIC.
873 have no ccp3, isn't it.
a thing that I want to do is dim controll of LED to port B0-B7.
I can't understand defnition of ccp.
so I need sample program.
Do realize port B0-B7 pwm controll at the same timing ?
I know multiple pwm controll by ASM even low-end pic, but I can not do this.
I dislike a C language like CCSC.
pbp with MCS evironment is ideal for me. especialy the variable is seen. it's so good.
regard.
Look at the '873 datasheet.
How many CCP modules does the '873 have?
What pins are those modules assigned to?
Archangel
- 15th February 2008, 01:28
give this a shot . . .
http://www.microchip.com/stellent/idcplgidcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en010235
My bad. it seems the links do not go anywhere . . .
skimask
- 15th February 2008, 04:04
Sorry that I do not understand about ccp.
usealy I see only about pin diagram in datasheet, so not know deeply understand about a PIC.
873 have no ccp3, isn't it.
Yes, you are correct, the '873 does not have a CCP3.
Also, the datasheet's pin diagram's in the CCP module chapter also show which pins are connected to each of the remaining 2 CCP modules.
a thing that I want to do is dim controll of LED to port B0-B7.
I can't understand defnition of ccp.
so I need sample program.
Do realize port B0-B7 pwm controll at the same timing ?
I know multiple pwm controll by ASM even low-end pic, but I can not do this.
There are more than a few examples (some very recent) of both software and hardware PWM control of pins on this site. All it takes is a bit of searching.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.