Hi,
I've been programming with PBP 2.42 for a while now, but have never had a problem that I couldn't overcome by reading the forums.
Recently, I tried to get Darrel Taylor's great Instant Interrupt program running. I installed MPASM, no problems there. The blink LED program worked great.
In order to incorporate the instant interrupt functionality back into my main code, I had to get that code assembling with MPASM (versus PM) first. I read all about the configuration fuses and am fairly sure I have them set correctly. The code compiles and loads (via MCS loader) into my 16F877a without any issues (the only warnings are the 'page boundary' warnings, which I ignore). However, the code runs very erratically now. The LCDOUT commands don't work, and the timing on my GPIO seems to be much faster.
After playing around with the configuration fuses, they don't seem to change anything. In fact, I can comment them out of my main code (and the 16F877a.inc file) and get the same erratic results.
I went back to Darrel's Interrupt program just to see if I could get my 16x1 LCD working there...no go.
In conclusion, I believe if someone can tell me why the code below doesn't work with my LCD, I will be able to figure out why it doesn't work in my main program. The portb.1 does toggle (as intended), but I get nothing on my LCD. The hardware is connected correctly as the LCD works with my main code compiled with PM. This program is basically Darrel Taylor's blinky program, but with an LCDOUT after the LCD toggle.
Thanks in advance for the help - there are so many talented people who contribute to this forum and I appreciate your time!
LED1 VAR PORTB.1
define osc 20 'using 20 MHz crystal
define loader_used 1 'using a loader...
define lcd_dreg portb 'set LCD data port
define lcd_dbit 4 'set LCD starting Data bit = 4 (portd.4-7)
DEFINE lcd_rsreg portb 'set LCD register select port
define lcd_rsbit 2 'set LCD register select bit
define lcd_ereg portb 'set LCD enable port
define lcd_egreg 3 'set LCD enable bit
define lcd_bits 4 'set LCD bus size (4 or 8 bits)
define lcd_lines 2 'set number of lines on LCD
define lcd_commandus 2000 'set command delay time in us
define lcd_dataus 50 'set data delay time in us
INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $31 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main:
PAUSE 1
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
TOGGLE LED1
lcdout $FE, $80, "Hi World"
pause 1000
@ INT_RETURN
\code
Bookmarks