No, it will take a bit more than that.
I would have posted something more complete, but I don't have access to my development board until Monday. When I get to my board, I'll be able to send you something that has been tested.
No, it will take a bit more than that.
I would have posted something more complete, but I don't have access to my development board until Monday. When I get to my board, I'll be able to send you something that has been tested.
Charles Linquist
Thats alright I have been trying to get it to work with the HPWM but I just dont quite understand how to get it to work. I put a LED on PORTB.0 and typed the following code but nothing happens to the light:
I was thinking I could use this for my clock pulse of 4096 times like this:Code:DEFINE OCS 4 C1 VAR WORD DEFINE CCP1_REG PORTB 'no clue what this does but I think I need it for the following line DEFINE CCP1_BIT 1 ' because 1 = portb.0 according to the manual I think? FOR C1 = 0 to 255 HPWM 1,C1,1000 NEXT
for right now I have a second external clock hooked up that I am turning on with throwing a pin high for a couple milliseconds and it fixed what I am trying to fix but its not exact like I need it to be.Code:FOR C1 = 0 TO 15 HPWM 1,127,frequency '50% duty/square wave NEXT
Thanks again for your time with this!
Hi,
Some PIC's can map the output of the CCP-module to different pins, the 'F88 can map it to either RB0 or RB3. The defines you have tells PBP to generate code to map the CCP1 output to the pin you specify. However, BIT 1 as you've specified means it tries to map it to PORTB.1 which isn't valid.
/Henrik.
Hi Wolwil,
You could replace PBP SHIFTOUT with attached ASM code example and reduce time spend in SHIFTOUT + loop to ~1/8. This is kind of tested, but no promises ... Check if it is usefull for you.
PBP_shiftout execution time was around 814uS, but ASM_shiftout took only 104uS to do the same.
Files:
PBP_shiftout.pbp.txt <- Original, copied from 1st post
ASM_shiftout.pbp.txt
(Just remove .txt from end of files)
I know that ASM version is spaghetti code but I don' really care
So long time since last time when I did something with ASM.
BR,
-Gusse-
Last edited by Gusse; - 11th May 2010 at 20:18.
See I was confused because in the manual it said:
So I was thinking the xx was what I was setting so I figured the LSB was 1 for port B0 and 2 for B3. Like I said I was confusedbit 3-0 CCP1M<3:0>: CCP1 Mode Select bits
0000 = Capture/Compare/PWM disabled (resets CCP1 module)
0100 = Capture mode, every falling edge
0101 = Capture mode, every rising edge
0110 = Capture mode, every 4th rising edge
0111 = Capture mode, every 16th rising edge
1000 = Compare mode, set output on match (CCP1IF bit is set)
1001 = Compare mode, clear output on match (CCP1IF bit is set)
1010 = Compare mode, generate software interrupt on match (CCP1IF bit is set, CCP1 pin is
unaffected)
1011 = Compare mode, trigger special event (CCP1IF bit is set, CCP1 pin is unaffected); CCP1
resets TMR1 and starts an A/D conversion (if A/D module is enabled)
11xx = PWM mode
So you are saying all I need to do is say 0 and not 1, right?
Thanks I will try this out tonight!
Last edited by wolwil; - 11th May 2010 at 21:34.
here is the code for the PWM:
looks like I didn't need all the extra mumbo jumbo before it as the 16f88 defaults to b0 for channel 1Code:C1 var byte For C1 = 0 to 31 hpwm 1,127,32767 next
The sad thing is this still is not fast enough to do what I need it to do.
I am trying to generate 4096 clock pulses as fast as possible. The chip will allow up to a 30MHz clock pulse to drive it but using the HPWM all I can get is 32,767Hz which is like paying full price for a Lamborghini that only has first gear.
Does anyone have any ideas on how I might be able to achieve this?
Bookmarks