You guys crack me up !
Ok' I'm working my way through this version using the 16F873A, but I've hit a small issue which is so basic I can't see why it responds the way it does (it worked with the 16F628a).
I have set port A to all inputs and added
I have a 10k pull up resistor between pin 4 (RA2) and +5v with a tactile switch between pin 4 and GND.Code:SW1 var PORTA.2 ;pattern selection switch
I've added the code
So in therory if the switch (sw1) is low then swcount is increased by 1, until it is > than 7 and if so then its swcount is reset to 1. This way the pattern is selected by pressing the switch.Code:if SW1=0 then swcount=swcount+1 ;check to see if up button pressed, if so add 1 to swcount pause 60 ;debounce delay If swcount>7 then swcount=1 ;error trap for exceeding max patterns
However in practice, the PIC simply ignores any input on RA2, but more confusingly, it runs each pattern once in sequence, ie it cycles through the patterns as if the button is being pressed, so swcount must in some way be changing as the remainder of the code works if the above lines are remed out and swcount is manual set to 1, 2, 3 etc, which results in just the selected pattern running.
Its probably me having a blonde moment (no offence to any fair haired madiens out thereCode:Pot PORTA.1,scale,D ;used to read value from 10k pot and set the speed read patt[swcount],steps ;read the first value of the selected patter and place it in the variable steps for C = 1 to steps ;for / next loop READ PATT[SWCOUNT]+ C,PORTB ;reads the step value for selected pattern and send it to PORTB PAUSE D ;delay for speed NEXT GOTO MAIN) - but can anyone shed some light why this isn't working.


) - but can anyone shed some light why this isn't working.


Bookmarks