MaxHeadRoom
- Joined Jul 18, 2013
- 28,698
Request a quote from Digikey, see what they say for delivery date.
I use this:I also would like the answer, I pondered on it today using a 18F series pic EEADR.
infsnz EEADR,F ; bump EE physical address
incf EEADRH,F
incf FSRxH,F ; pre-increment high byte
incfsz FSRxL,F ; increment low byte and if it rolled to 00, leave high byte incremented
decf FRxH,F ; else no rollover of low byte, decrement high byte to previous value
; or
incf FSRxL,F ; bump low byte
btfsc STATUS,Z ; iff it rolled over to 00..
incf FSRxH,F ; bump high byte
Thanks, the 18F I am using does not use the EEADRH register.I use this:
It would work on FSRxL and FSRxH as well.Code:infsnz EEADR,F ; bump EE physical address incf EEADRH,F
I think I read somewhere that the instruction is legit, but it will only increment the FSR low byte, and won't increment the high byte in case of an overrun.I also would like the answer, I pondered on it today using a 18F series pic EEADR.
VarA EQU 0x21 ;VarA is located in register bank 0
VarB EQU 0xA1 ;VarB is located in register bank 1
movlb 0 ;set register bank 0
movf VarA, w ;copy the contents of VarA into VarB
movwf VarB
radix dec
; banksel VarA ; bank 00 |00
movlb VarA/128 ; bank 00 |00
movf VarA,W ; |00
; banksel VarB ; bank 01 |01
movlb VarB/128 ; bank 01 |01
movwf VarB ; |01
Dang it! ... I keep forgetting that this device works using a 14-bit architecture and its limitations ... excellent explanation, MM ... thanks for clarifying.Your example will simply write the contents of VarA back into VarA (on the "enhanced mid-range devices"). Byte-oriented file register operations (like movf and movwf) only include 7 bits of the file register address within their 14 bit opcode.
The banksel pseudo instruction actually generates a movlb instruction and you can use movlb in place of banksel if you divide the file register address in the operand by 128. Example;
Have fun. Cheerful regards, MikeCode:radix dec ; banksel VarA ; bank 00 |00 movlb VarA/128 ; bank 00 |00 movf VarA,W ; |00 ; banksel VarB ; bank 01 |01 movlb VarB/128 ; bank 01 |01 movwf VarB ; |01
Yes, if the flag is not cleared (there are times when this is the desired behaviour with an ISR state machine) but some interrupt flags are cleared by actions like reading a USART buffer.Quick question.
What would happen if the MCU's interrupt feature is enabled, an interrupt flag is raised and therefore the program immediately branches to the ISR, the code is executed, but the corresponding interrupt flag IS NOT cleared before returning from the servicing routine? ... would the ISR be immediately executed again and again in an endless loop?
interesting ... does an example come to mind?there are times when this is the desired behaviour with an ISR state machine
It's for code timing tricks where almost all processing happens in an ISR and/or DMA and main is just a idle loop.interesting ... does an example come to mind?
The remaining problem is dynamic updates to the video memory. All of the memory bandwidth (something in short supply with the simple DMA architectures seen in most 8-bit controllers) is being used by DMA so excessive processing during DMA will affect H/V timing causing tearing and loss of sync. The fix for that is to only process mainline code during the scanlines with no video around the H sync pulse. For that we need a simple task manager that uses the high/low priority interrupt structure and a 'hold' flag.
Setup a Low priority timer ISR as the 'idle' loop; This idle loop can be interrupted by High priority DMA completion and other module interrupt requests so those time critical processes get the cpu they need during the NTSC FSM. The 'idle' loop can also set a task time duration for the main task that will interrupt the main task back to the low priority idle loop during the critical timing periods. This means I can step into the main application code execution when I want it to run it and control how long I want one processing time slice to be.
by Duane Benson
by Aaron Carman
by Jake Hertz
by Jake Hertz