Hello,
i use the 12f1822 and trying the PWM, if CCPR1L=0 it throws the messages
TMR2 BUG!! value = 0x3d09c7 which is greater than 0x100 .
i try ed and at startup with zero duty cycle and makes the same messages
CCP1CONbits.DC1B = 0
CCPR1L = 0
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have tried the following code (with RA5 set as output) and do not see the problem. I am trying to fix the cases which cause the message.
BANKSEL APFCON
bsf APFCON,0 ;PA1 RA5
BANKSEL CCPR1L
clrf CCPR1L
movlw 0x0f
movwf CCP1CON
BANKSEL PR2
movlw 0x0f
movwf PR2
bsf T2CON,TMR2ON
goto $
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Critical condition for bug is CCP PWM duty cycle greater than zero and less than four with precount=1. I have committed, on SVN, a greatly modified TMR2 modules (in 14bit-timers) which passes my tests of this problem. Please try the latest SVN.
Regards,
Roy Rankin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes it works OK.
One problem i had was with lyx
Warning: 544: Format not supported.
Warning: Quitting.
**Error: Conversion script failed
----------------------------------------**
/root/Downloads/lakis/gpsim/gpsim-code-r2564-trunk/doc/gpsim.lyx is from a newer version of LyX and the lyx2lyx script failed to convert it.
LyX failed to load the following file: /root/Downloads/lakis/gpsim/gpsim-code-r2564-trunk/doc/gpsim.lyx
i copied from older version gpsim.lyx to bypass it.
Please give a direction
I have a usb card ch341A with parallel port, how to make it communicate with gpsim as a real module and use real elements.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
i use the 12f1822 and trying the PWM, if CCPR1L=0 it throws the messages
TMR2 BUG!! value = 0x3d09c7 which is greater than 0x100 .
i try ed and at startup with zero duty cycle and makes the same messages
CCP1CONbits.DC1B = 0
CCPR1L = 0
update
the error occurs if CCP1CONbits.DC1B >0 and CCPR1L = 0
(DC values 3 and less)
I have tried the following code (with RA5 set as output) and do not see the problem. I am trying to fix the cases which cause the message.
BANKSEL APFCON
bsf APFCON,0 ;PA1 RA5
BANKSEL CCPR1L
clrf CCPR1L
movlw 0x0f
movwf CCP1CON
BANKSEL PR2
movlw 0x0f
movwf PR2
bsf T2CON,TMR2ON
goto $
i use RA2 for output. Compile and run it, makes the error
define NO_BIT_DEFINES
include <pic14regs.h></pic14regs.h>
include <stdint.h></stdint.h>
//sdcc -mpic14 -p12f1822 --use-non-free pic-supply.c
// pk2cmd -B/usr/share/pk2 -ppic12F1822 -Fpic-supply.hex -M -Y
//pic12f1822 2pin 7=RA0-AN0, 6=RA1-AN1 ADC, 2pin USART 2=RA5-RC, 3=RA4-TX, 1pin out 5=RA2 =5pins scope.ch0 = 'porta2'
__code uint16_t __at (_CONFIG1) __configword = _FOSC_INTOSC & _BOREN_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDTE_OFF & _CP_OFF & _CPD_OFF ;
void main (void){
init:
INTCONbits.GIE = 1 ; //Global interrupts enabled
INTCONbits.PEIE = 1 ; //Periferal interrupts enabled
PIE1bits.ADIE = 1 ; //adc interrupt
PIE1bits.TMR1IE = 1 ; //Timer1 interrupts enabled
//PIE1bits.TMR2IE = 1 ; //Timer2 interrupts enabled
PIE1bits.RCIE = 1 ;
OSCCON = 0b11101000 ; //4MHz
CM1CON0bits.C1ON = 0 ; //Comparator OFF CMxCON0:
MDCON = 0 ;
ANSELA = 0x00 ;
//IOCA = 0x00 ; //Interrupt on change off
WPUA = 0x00 ; //pullups off
TRISA = 0b00100011 ; //make all outputs except RA0, RA1, RA5 =input
PORTA = 0 ; //make all pins low
APFCONbits.RXDTSEL = 1 ; //RXDT on RA5
APFCONbits.TXCKSEL = 1 ; //TXCK on RA4
APFCONbits.CCP1SEL = 0 ; //P1A on RA2 pin5
ANSELA = 0b00000011 ; //AN0, AN1 analog input (prota prepei set APFCONbits)
RCSTAbits.SPEN = 1 ;
TXSTAbits.SYNC = 0 ;
TXSTAbits.BRGH = 1 ;
TXSTAbits.TXEN = 1 ;
SPBRG = 25 ;
RCSTAbits.CREN = 1 ;
FVRCON = 0b11000001 ; //Vref enabled 1.024V
ADCON0 = 0x00 ;
ADCON1 = 0b11010011 ; //adfm=1, //f/16=62500Khz 16us, //Vref internal
T1CON = 0b00100001 ; //clock instruction, prescaler :4, timer1 ON
//TMR1L = 0 ;
TMR1H = 0x0B ; //65555-3055 =62500 x4 =250000
TMR1L = 0xBD ;
PR2 = 66 ;
CCP1CON = 0b00111100 ;
//CCP1CONbits.P1M = 0b00 ; //Output Config, only P1A modulated
//CCP1CONbits.DC1B = 0b01; //2 first bits of Duty Cycle
//CCP1CONbits.CCP1M = 0b1100 ;//PWM Mode active high or low
CCPR1L = 0 ;//8 last bits of Duty Cycle
PIR1bits.TMR2IF = 0 ; //Clear Interrupt Flag
T2CONbits.T2CKPS = 0 ; //TIMER2 prescaler=1
T2CONbits.TMR2ON = 1 ; //TIMER2 ON
//init telos
arxi:
goto arxi;
}
Critical condition for bug is CCP PWM duty cycle greater than zero and less than four with precount=1. I have committed, on SVN, a greatly modified TMR2 modules (in 14bit-timers) which passes my tests of this problem. Please try the latest SVN.
Regards,
Roy Rankin
Yes it works OK.
One problem i had was with lyx
Warning: 544: Format not supported.
Warning: Quitting.
**Error: Conversion script failed
----------------------------------------**
/root/Downloads/lakis/gpsim/gpsim-code-r2564-trunk/doc/gpsim.lyx is from a newer version of LyX and the lyx2lyx script failed to convert it.
LyX failed to load the following file: /root/Downloads/lakis/gpsim/gpsim-code-r2564-trunk/doc/gpsim.lyx
i copied from older version gpsim.lyx to bypass it.
Please give a direction
I have a usb card ch341A with parallel port, how to make it communicate with gpsim as a real module and use real elements.