Matt Bonner wrote: > > David VanHorn wrote: > > > > I don't do C, but shouldn't you have some sort of chip setup code that > > defines those pins as outputs, and maybe sets up a timer or something?? > > > > The frequency of the crystal also enters into it, else how to know when N > > seconds have passed? All the chip knows is xtal clocks, which don't have a > > finite relationship to realtime. > > David, > The 2 issues you raise are likely being handled by the following lines > in Joshua's code: > #include <16c715.h> > #use delay(clock=20000000) > What David is refering to is the ASM "TRIS" command. It is used to setup the I/O pins whether it is used as output or input. The header file does not do this for you, it only points to the Tris register. > Joshua, > I don't know the PCM compiler, but your code looks OK (if my comments > above to David are correct). Can you describe your hardware? > > --Matt Joshua asked for the ASM version for his proggy. Here is my feeble attempt (the way I understand it. Note, I also don't use C): list P=16C715 include <16C715.h> LED1 EQU 0 ;PORTA bit 0 LED2 EQU 1 ;PORTA bit 1 org 0 movlw 0x00 ;setup PORTA to be output TRIS PORTA ;or "CLRF TRISA" to replace both lines used with ;header file CLRF PORTA ;reset PORTA START BSF PORTA,LED1 ;Switch on LED1 CALL DELAY ;CALL DELAY Subroutine (not included here) BCF PORTA,LED1 ;LED1 off NOP ;Not always needed, just good housekeeping NOP BSF PORTA,LED2 CALL DELAY BCF PORTA,LED2 GOTO START ;Subroutines ;Subs go here end