deltatech
Joined: 22 Apr 2006 Posts: 87
|
CODE CONVERSION FROM asm TO CCS C ! |
Posted: Mon May 01, 2006 3:23 pm |
|
|
Hi i am a new to CCS C i have bought a PICDEM Mechatronics Board its come with this lab example in ASM. Can you experts convert it to CCS C code so that i can understand it and try it out in C many thanks for your help . Code: |
include <p16f917.inc>
include LCD.inc
STARTUP code
goto Start
PORT1 code
Start
bsf STATUS,RP0 ; we'll set up the bank 1 Special Function Registers first
bcf TRISD,2 ; set RD2 as the motor output
movlw b'01110000' ; select the 8Mhz internal oscillator
movwf OSCCON
movlw 0xFF ; select 7.9 kHz PWM
movwf PR2
bcf STATUS,RP0
movlw b'00001100' ; pwm mode
movwf CCP2CON
bsf T2CON,TMR2ON ; turn on PWM
call InitLCD ; Initialize the LCD module
clrf CCPR2L ; Clear Duty Cycle
bsf ADCON0,ADON ; Turn the ADC module on
LoopOuter
bsf ADCON0,GO_DONE
LoopInner
btfsc ADCON0,GO_DONE
goto LoopInner
movf ADRESH,w
call DisplayDecimal ; Display the ADC value
movf ADRESH,w
; movwf CCPR2L ; make POT1 reading the duty cycle
call QuietPWM
goto LoopOuter
END
|
|
|