New Timer Unit
Added a timer unit to the IOP16. The timer unit allows a time value to be written to the Timer and the timer can be polled from the IOP16 to determine when the time has elapsed.
The timer unit can count in uSecs (0-255), mSecs (0-255) or Seconds (0-255). Writing the appropriate time value to the timer unit starts the timer running. The timer status register indicates when the count is in progress (d0 = 1). This facilitates simple polling.
Here's the IOP16 code to blink an LED off and every second:
000 START 0x7800 IOW #0x00 IO_00 WRITE TO LED 001 0x2001 LRI Reg0 0X01 TIME 1 SEC 002 0x7006 IOW Reg0 IO_06 STORE TO START TIMER 003 WAITDUN 0x6104 IOR Reg1 IO_04 READ TIMER 004 0x8101 ARI Reg1 0X01 CHECK BUSY 005 0xDFFE BNZ WAITDUN 006 0x7900 IOW #0x01 IO_00 WRITE TO LED 007 0x2001 LRI Reg0 0X01 TIME 1 SEC 008 0x7006 IOW Reg0 IO_06 STORE TO START TIMER 009 WAITD2 0x6104 IOR Reg1 IO_04 READ TIMER 00a 0x8101 ARI Reg1 0X01 CHECK BUSY 00b 0xDFFE BNZ WAITD2 00c 0xE000 JMP START
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.