DT, you have given the PBP & PIC users a great gift with your instant interrupts!
My application can't wait for the current statement execution to complete for 'ON INTERRUPT' use.
I've implemented your latest creations after reading your website on DT_INTS-14.
Also, have studied many similar threads with similar problem & tried the posted solutions, but I still get compile errors:
(using PIC16F1826 / PBP2.60C / MPASM )
Error[113]c:\pbp\pbppi14e.lib 1182 : Symbol not previously defined (INT_ENTRY)
Error[113]c:\pbp\pbppi14e.lib 1182 : Symbol not previously defined (INT_ENTRY)
Error[113]c:\pbp\pbppi14e.lib 720 : Symbol not previously defined (INT_EXIT)
Error[113]c:\pbp\pbppi14e.lib 733 : Symbol not previously defined (INT_EXIT)
Error[113]c:\pbp\pbppi14e.lib 737 : Symbol not previously defined (INT_EXIT)
Warning[207]c:\microc~2\pi34cc~1.asm 720: Found label after column 1. (INT_Create)
complete code:
Code:
'******************************
OSCCON = $73 'or %01110011 is for use intosc of 8Mhz
'OSCCON = %11110000 '32Mhz intosc use
Define OSC 8 'define the timing for PBP timing such as pause & serout
'*********************************************
'
'Tris register 1=input(PORdefault) 0=output
'Ansel register 1=analoginput(PORdefault, digital reads are 0) 0=digitalinput
ANSELA = %00001100 '1 = Analog used / Vref+(A3) and Vref-(A2)
ANSELB = %00100000 '1 = Analog used / ADC in (B5 / AN7)
TRISA = %00111100 '0 is output ; 1 is an input(POR Default)
TRISB = %10111111 'Port B
'OPTION_REG.6 = 1 'INT interrupt acts on RISING EDGE
'CLKRCON = %11010000 'Turn on ref clock output BE SURE TO DISABLE "CLOCK OUT" IN MEPROGRAMMER
'
'
'*******Variables*************************
'HeadUnit Connections
HUdat var PORTB.0 'Headunit communications Input or Output
'Strain Gage Connections
GagePwr var PORTA.1 'PowertoStrainBride Output
ADCPin VAR PORTB.5 'StrainSample AN7 Input
'Hall Effect Sensor Connections
SpdDat var PORTB.3 'HallSensor Input
'Digital Pot Connections
PotCS var PORTA.0 'CS DigiPot Output
PotClk var PORTA.7 'SCK DigiPot Output
PotDat var PORTA.6 'SDI DigiPot Output
'Temperature Sensor Connections
TmpSDA var PORTB.4 'SDA Data TempSensor Input
TmpSCL var PORTB.6 'SCL Clock TempSensor Output
'**
wsave VAR BYTE $20 SYSTEM ' location for W if in bank0
'**
'****************************************
Y var byte
Neg var byte
Pos var byte
X var word '16bit variable for PULSIN, 0 to 65,535
SData1 var word 'Speed data
SData2 var word 'Speed data to be sent (Use prior pulse)
WiprPos var byte 'Digipot Command
WiprNeg var byte 'Digipot Command
Mark var byte
Space var byte
Strain var word 'Sampled Strain Value from WheatstoneBridge
'****************************************
wiprneg=%00100000 'Wiper0 v 0000 0000 (nv 0010 0000) write
wiprpos=%00110000 'Wiper1 v 0001 0000 (nv 0011 0000) write
mark=60
Y=0
neg=0
pos=0
x=0
input hudat 'start HUdat as an input pin
'*********************************************
'Interrupt system works on "INT" pin B.0 that is named "HUdat" in the above
include "DT_INTS-14.bas" ;Interrupt System
INCLUDE "ReEnterPBP.bas" ;to use with PBP Interrupt handlers
'*********************************************
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag
INT_Handler INT_INT, _HandleInt, PBP, yes
endm
INT_Create ;create interrupt processor
endasm
@ INT_ENABLE INT_INT ;enables external interrupts
'*****************************************
Start:
'Set Digital Pots
pause 10
neg=240 '257 is ground
pos=60 '0 is full +V supply
low potcs 'Use Digital Pot's mode 0,0 and its MSB first & Clk idles low
shiftout potdat, potclk, 1, [wiprneg, neg] '8bit digi pot
high potcs
pause 50
low potcs 'Use Digital Pot's mode 0,0 and its MSB first & Clk idles low
shiftout potdat, potclk, 1, [wiprpos, pos] '8bit digi pot
high potcs
pause 10
'***********************
Main:
pauseus 10
pulsin spddat,1,sdata1
sdata2 = sdata1 'store speed data into another var as keep-safe vs. INT
'if hudat then
'' pauseus 2100
' output hudat
' serout2 hudat,16530,[strain.highbyte,strain.lowbyte]
'endif
goto Main
'********************************************
HandleInt:
output hudat 'make HUdat an output pin to send data
strain=24650 'test value
serout2 hudat,16530,[strain.highbyte,strain.lowbyte]
input hudat 'switch HUdat back to an input pin to receive interrupt
@ INT_RETURN
'* * * * * * * * * * * * * * * * * *
Your help would be greatly appreciated, since my application must have an 'instant interrupt'.
[ In this application I have a sensor-unit(code shown above) connected to a head-unit. HUdat pin is on the sensor-unit and awaits a simple signal from the head-unit to activate an interrupt and send data on the same connection. ]
You guys are the best & thanks in advance!
-ray
Bookmarks