freq gen set pin
| Author | Message | ||||
| Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5186 |
Ideally you would use some sort of PWM output, where you set the on time, off time and it will run in the background until you make a change to it. At this time the Maximite doens't support a PWM output, so we need to do it with software. I havn't tried it yet but you might be able to use the SETTICK command. Its a interrupt, meaning it will interrupt your normal program at a certain time. I havn't tested this, its probably broken. The two timer routines at 1000 and 2000 should flip flop between eachother. 5 SETPIN 10,8 'Set as output 10 SETTICK 100,1000 'Start timer in 100ms 20 ' Normal program, do stuff 30 PRINT RND() 40 GOTO 30 1000 'On Time, 10ms 1010 SETTICK 10,2000 1020 PIN(10)=1 1030 IRETURN 2000 'Off Time, 100ms 2010 SETTICK 100,1000 2020 PIN(10)=0 2030 IRETURN Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||