How do I create a short cut to an instruction in PBP such as
H9 means or points to instruction like HIGH PORTB.0 ?
So instead of writing HIGH PORTB.0: PAUSE 10 : LOW PORTB.0
I can write H9: PAUSE 10: H9 ??
Cheers
Michael
How do I create a short cut to an instruction in PBP such as
H9 means or points to instruction like HIGH PORTB.0 ?
So instead of writing HIGH PORTB.0: PAUSE 10 : LOW PORTB.0
I can write H9: PAUSE 10: H9 ??
Cheers
Michael
You can create aliases to port.pins like this...
H9 var PORTB.0
Then you can do this...
MAIN:
HIGH H9: PAUSE 100: LOW H9: PAUSE 100
GOTO MAIN
This is detailed in the PBP manual, section 4
I am not aware of a way to do a macro that will execute several commands... someone else may know a way.
Last edited by Heckler; - 2nd October 2012 at 15:45.
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Thanks for the insight, however I want to say...
H9 : pause 10 ...... not HIGH H9 pause 10 .... and achieve same result
I want H9 to mean HIGH PORTB.0
I am old and frail and need help.
Michael
I'm curious why the GOSUB command does not suit your needs.
Do you want to substitute just that one command? If so, you are creating a lot of overhead for something really small.
If it's because you want to keep things extra simple in your code, what about clear comments? My memory is no longer what it used to be so I include a LOT of comments in my code. Comments do nothing to your program; they take no space and do not affect performance.
Robert
I am frail, old and grey and have lost my book.
Here it is again; I think I have not formed the question correctly.
I want to convert:
main:
HIGH PORTB.0 : PAUSE 10 : LOW PORTB.0 : PAUSE 10
GOTO main
to
main:
H9 : PAUSE 10 : LOW H9 : PAUSE 10
GOTO main
?? Can I precede the code with H9 VAR HIGH PORTB.0 ??
Michael
I am frail, old and grey and have lost my book.
It has temporarily disappeared into a QBH, Quantum Black Hole, which I find abound in my locality.
not sure if this what you want but if i am reading this correctly the code might be the following ,
Assumptions that is taken for the following example code are
1.digital ports have been set in config not analog
2. the OSC type is defined in config correct value , assumed to be 8Mhz in example ,
3. the port is setup for output in config eg TRISB = %00111100
4. the port used is able to be output not input only
5. correct setting of week pullups is set
6. the output pulse is expected to be a digital output not varable analog
7. other external ccts not effect current drain on output etc
8, that other code required in pic will not stop the loop
This code only creates a square wave pulse of 10Ms high and 10ms low during its continued execution ,and thats fine as long as thats all its going to do and no other program needs to be called else it will stop
to make it clearer and to get what you end up wanting it would help if you advised the chip type ,and associated ccts and what the end goal is
but given these assumptions above
regardsCode:DEFINE OSC 8 ' Timing referance for pause , pauseus commands H9 var PORTB.0 ' Port B.0 is output pin digital TTL H9 = 0 ' Set output to low on startup Main: H9 =1 ' Set output to high pause 10 ' allow it to be high for 10ms H9=0 ' set output to low pause 10 ' allow pulse low for 10ms goto main
Sheldon
same code example as u wanted but without the comments is
Code:DEFINE OSC 8 ' Timing referance for pause , pauseus commands H9 var PORTB.0 ' Port B.0 is output pin digital TTL H9 = 0 ' Set output to low on startup can remove and assume it 0 to start but hey Main: H9 =1 :pause 10 :H9=0: pause 10 goto main
Bookmarks