'New Template for SX/B 2.0 ' ========================================================================= ' ' File...... ' Purpose... ' Author.... David Mcanulty ' E-mail.... dave000@hellspark.com ' Started... ' Updated... ' ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Conditional Compilation Symbols ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- ID "template" DEVICE SX28, OSCHS3, BOR42 FREQ 50_000_000 STACK 16 ' ------------------------------------------------------------------------- ' I/O Pins ' ------------------------------------------------------------------------- Servo PIN RA.0 OUTPUT ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- ServoVal VAR Word I VAR BYTE ' ========================================================================= ' INTERRUPT {option} {rate} ' ========================================================================= ISR_Start: ISR_Exit: ' RETURNINT {cycles} ' ========================================================================= ' Subroutine / Function / Task Declarations ' ========================================================================= DELAY_MS SUB 1, 2 'delay in milliseconds, sub prevents duplicate asm code ' ========================================================================= PROGRAM Start ' ========================================================================= Start: PLP_A = %0000_0000 'Pullup unused inputs 1=pullup PLP_B = %0000_0000 'Pullup unused inputs 1=pullup PLP_C = %0000_0000 'Pullup unused inputs 1=pullup Main: 'For ServoVal = 190 to 130 'PULSOUT Servo, ServoVal 'PAUSE 20 'NEXT 'FOR ServoVal = 130 to 190 'PULSOUT Servo, ServoVal 'PAUSE 20 'NEXT For I=0 to 255 PULSOUT Servo, 75 'Right DELAY_MS 20 NEXT 'end of for loop For I=0 to 255 PULSOUT Servo, 225 'Left DELAY_MS 20 NEXT 'end of for loop GOTO Main ' ------------------------------------------------------------------------- ' Subroutine / Function / Task Code ' ------------------------------------------------------------------------- SUB DELAY_MS ' Use: DELAY_MS msecs Local_TempW VAR BYTE (2) IF __PARAMCNT = 1 THEN Local_TempW = __PARAM1 ' save byte value ELSE Local_TempW = __WPARAM12 ' save word value ENDIF PAUSE Local_tempW ENDSUB ' ------------------------------------------------------------------------- ' ========================================================================= ' User Data ' =========================================================================