Re: [Sdcc-user] Setting up PWM for PIC 16F628

2008-07-13 Thread Peter Chant
On Sunday 13 July 2008, [EMAIL PROTECTED] wrote: > If the code doesn't run as expected then there is a problem in your > hardware, wirering, config etc. etc. > Re-written the machine code for initialisation in C. I suspect, but have not checked, that it is something to do with the value I set i

Re: [Sdcc-user] Setting up PWM for PIC 16F628

2008-07-13 Thread sdcc
Hi Peter Peter Chant schrieb: > void pwm_setup(void) { > _asm > > ;#define STATUS 0x03 > make sure that bank0 is selected here (BCFSTATUS, RP0) > CLRF CCP1CON ; CCP Module is off > CLRF TMR2 ; Clear Timer2 >;clrf 0x11 ; timer 2 is 0x11 > _endasm; > CC

Re: [Sdcc-user] Setting up PWM for PIC 16F628

2008-07-13 Thread Peter Chant
On Sunday 13 July 2008, [EMAIL PROTECTED] wrote: > which version of sdcc are you using? In my version (2.8.0) TMR2ON is > defined in the T2CON_bits struct. Anyway i just saw the TMR2ON is set to > T2CON_bits.TMR2ON with a #define. > 2.8.2 > As a workaround you could use the pwm initialization ex

Re: [Sdcc-user] Setting up PWM for PIC 16F628

2008-07-13 Thread sdcc
Hi Peter, Peter Chant schrieb: > I tried a number of option. TMR2ON = 1 does not cause and errors but > T2CONbits.TMR2ON is not defined in the header files for these chips. which version of sdcc are you using? In my version (2.8.0) TMR2ON is defined in the T2CON_bits struct. Anyway i just saw

Re: [Sdcc-user] Setting up PWM for PIC 16F628

2008-07-13 Thread Peter Chant
On Sunday 13 July 2008, [EMAIL PROTECTED] wrote: > The code looks ok. I only have 18f2XXX devices here and there the pwm > pins are on PORTC (TRISCbits.TRISC1 and TRISCbits.TRISC2) by default and > the TMR2 is enabled with T2CONbits.TMR2ON = 1; In your code you used > TMR2ON = 1, not sure if that

Re: [Sdcc-user] Setting up PWM for PIC 16F628

2008-07-13 Thread sdcc
Hi > hope this is the correct place. Can't seem to get PWM working, this is my PWM > set up routine is below. Have not tried it in hardware - but gpsim shows the > correct pin set to an output but it does not have a signal on it. > The code looks ok. I only have 18f2XXX devices here and t

[Sdcc-user] Setting up PWM for PIC 16F628

2008-07-13 Thread Peter Chant
Chaps, hope this is the correct place. Can't seem to get PWM working, this is my PWM set up routine is below. Have not tried it in hardware - but gpsim shows the correct pin set to an output but it does not have a signal on it. Thoughts? Pete void pwm_setup() { //Set PR2 to 255 -