As I'm piddling about trying to learn all this with some ideas in mind, I keep thinking I must remember to thank all the people from here for all the help I've gotten. sure, you may not have answered a question from me directly, but your posts have answered sooooooooooo very many questions before I ever had the chance to ask!
Melanie, Darrel, Trent, Bruce, Joe S., Steve, Russ, omg, this list would take up many pages if I really tried to type it out.. so if ya posted, I've probably read it and learned something, so thank you..
and, to Darrel, sorry for mangling your code so badly. lol (you never saw the result, but wow what a mess I made.![]()
probably cant even remember where that's from is so twisted lol.. (and broken now, been scrapped and redone)Code:asm INT_CODE ;if greater than 2k code_size pbp uato saves ;wsave,ssave,and psave (W,Status,PcLatH) if (CODE_SIZE <= 2) ; contradictory - Only with PBP! if pure assembly, ; we ALWAYS need to save these values. ; as I don't do assembly yet, not an issue lol movwf wsave ; copy W to wsave register swapf STATUS,W ; swap status reg to be saved into W clrf STATUS ; change to bank 0 regardless of current bank movwf ssave ; save status reg to a bank 0 register movf PCLATH,w ; move PCLATH reg to be saved into W reg movwf psave ; save PCLATH reg to a bank 0 register endif btfss PIR1, TMR1IF ; is TMR1IF set? "Bit Test Flag? Skip if Set" GOTO NoTimer ; No, exit interrupt bcf T1CON,TMR1ON ; Turn off timer ;do i need bank change here? NO, intcon AND T1CON are bank0! bcf INTCON, 6 ; disable Peripheral interrupts bcf INTCON, 7 ; disable Global interrupts MOVF _led1data,W call bin2seg MOVWF PORTD bsf _led1digit call dly7seg bcf _led1digit movf _led2data,W call bin2seg movwf PORTD bsf _led2digit call dly7seg bcf _led2digit movf _led3data,W call bin2seg movwf PORTD bsf _led3digit call dly7seg bcf _led3digit bcf PIR1, TMR1IF ; Clear Timer1 Interrupt Flag PIR1 is bank0 ; DT must have been counting cycles as it WAS critical ; for sspwm!!!! now I think I know where the +8 comes from ; in his on_val/off_val calculations MOVF _TMR1_VAL,W ; 1 ;blatantly stolen from DT's SSPWM (less than Vague understanding) ADDWF TMR1L,F ; 1 ; reload timer with correct value BTFSC STATUS,C ; 1/2 ;Say wha? i'm lost here ;ok, if byte less than 255, no carry so skip INCF TMR1H,F ; 1 ;was a carry so add 1 to high reg? MOVF _TMR1_VAL+1,W ; 1 ;I have no idea what how why!? ADDWF TMR1H,F ; 1 ;lowbyte/high byte? but how is shifting done? bsf T1CON,TMR1ON ; 1 ; Turn it back on T1CON is bank0 ;will need to understand how the --ll that works. Must ASK DT or pbp group ;seems fundamental to know how to load a timer duh ;maybe if I write it out it will become obvious, ;more than likely will stay as visible as air lol ;reload timer here? ;DONE, we want to be able to control LED refresh times ;restart timer here? ;DONE as part of timer reload ;do i need bank change here? NO, intcon is bank0 bsf INTCON, 6 ; Re-Enable Peripheral interrupts bsf INTCON, 7 ; Re-Enable Global interrupts NoTimer movf psave,w ; Restore the PCLATH reg movwf PCLATH swapf ssave,w ; Restore the STATUS reg movwf STATUS swapf wsave,f swapf wsave,w ; 6/34 ; Restore W reg Retfie ; Exit the interrupt routine
for something lighter?
lol, did that for a friends transciever. :PCode:presetbut: pretemp=0 if presetbutton=1 then return else while presetbutton=0 pretemp=pretemp+1 pause 50 if pretemp=1 then lcdout $fe,1,"Preset" endif if pretemp=200 then lcdout $fe,$c0,"Stored" endif if pretemp=1000 then lcdout $fe,1,"LEGGO MY BUTTON!" endif if pretemp=5000 then lcdout $FE,1, "SELF DESTRUCT" lcdout $fe,$c0," ACTIVATED! " pause 500 LCDOUT $fe,$c0," " for dummy=5 to 0 step -1 lcdout $fe,$c0,#dummy pause 700 next dummy lcdout $FE,1,"Melanie says:" lcdout $FE,$C0,"Drink More Beer!" 'must thank Melanie for button routine examples, made it easy to figure out. TMR1ON = 0 'turn off display timer ie, no interrupt! @ sleep ;ni ni, gotta turn off then back on. I so mean! endif wend if pretemp>199 then write 1,y else read 1,y gosub setch 'set output, get display info lcdout $fe,1,"Preset" lcdout $fe,$c0,"loaded" pause 1000 gosub display2 'refresh display with appropriate new info endif endif return
and yes, you got a mini peek of me talking to myself in the notes. :P




Bookmarks