'182431 INT 8Mhz TIMER TEST 10.00 14.12.15 'This needs both sides of each H-Bridge pair connected together Define SIMULATION_WAITMS_VALUE = 1 Define CONFIG1L = 0x00 Define CONFIG1H = 0x08 Define CONFIG2L = 0x0c Define CONFIG2H = 0x20 Define CONFIG3L = 0x04 Define CONFIG3H = 0x80 Define CONFIG4L = 0x80 Define CONFIG4H = 0x00 Define CONFIG5L = 0x0f Define CONFIG5H = 0xc0 Define CONFIG6L = 0x0f Define CONFIG6H = 0xe0 Define CONFIG7L = 0x0f Define CONFIG7H = 0x40 'PORTC.2 as CCP1 [pwm1] Forward 'PORTC,1 as CCP2 [pwm2] Reverse 'When running in Oshonsoft Sim 'to view PWM use Scope, Normal , Settings, display width 1000 'to check use Hardware UART ADCON0 = %01000001 ADCON1 = %00000000 OSCCON = %01110010 'internal 8Mhz clock Dim duty1 As Byte Dim duty2 As Byte Dim pwm1 As Byte Dim pwm2 As Byte Dim time As Byte TRISA = %00000001 TRISB = %00000000 TRISC = %10001000 'assign PWM pins PWMon 1, 8 'RC1 CCP1, Mode at 8MHz at 7812Hz, to change this look at the Manual Tables PWMon 2, 8 'RC2 CCP2 duty1 = 100 duty2 = 155 'testing only main: If RA0 = 1 Then RB4 = 1 Else RB4 = 0 Endif Toggle RB6 '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> T2CON = 64 'bits 6-3 Post scaler 1:1 thru 1:16 T2CON.TMR2ON = 1 'bit 2 turn timer2 on; T2CON.T2CKPS1 = 1 'bits 1-0 Prescaler Rate Select bits T2CON.T2CKPS0 = 0 PR2 = 139 time = time + 1 '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< If PORTA.3 = 0 Then PWMduty 2, 0 'ASM: bcf CCP2CON,DC2B0 'ASM: bcf ccp2con,dc2b1 'ASM: movlw 0x00 'ASM: movwf ccpr2l 'Adcin 0, duty1>>>>>>>>>>>>>>>>>>>>>>>>>>>>.Not supported PWMduty 1, duty1 Endif If PORTA.3 = 1 Then PWMduty 1, 0 'ASM: bcf CCP1CON,DC1B0 'ASM: bcf ccp1con,dc1b1 'ASM: movlw 0x00 'ASM: movwf ccpr1l 'Adcin 0, duty1>>>>>>>>>>>>>>>>>>>>>>>Not supported PWMduty 2, duty1 Endif Goto main End