Nope.Can you still use the "b and h" in PCB?
From the manual.
4.8. Numeric Constants
PBP allows numeric constants to be defined in the three bases: decimal, binary and hexadecimal. Binary values are defined using the prefix '%' and hexadecimal values using the prefix '$'. Decimal values are the default and require no prefix.
100 ' Decimal value 100
%100 ' Binary value for decimal 4
$100 ' Hexadecimal value for decimal 256
Dave
Always wear safety glasses while programming.
What if I want to use a cb channel switch instead of an encoder? The first four pins have a logical progression of 0000 to 1111. Couldn't I use this like a Gray code encoder? Count increase would equal up and count decrease would equal down. What do you think?
You can use that, you can use the thing you already have, its up to you. They both CAN work. With the CB switch you will only get 16 changes per full revolution. If this is enough then use it. It will prolly still have noisey output so de-bouncing will still be neccessary. Now if you can get this, I have used many, they work really well.
Let us know how you are getting along on this project. Have you blinked a LED on port A yet?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Search here . . .
http://www.mouser.com/Electromechani...ers/_/N-39xfc/
Seriously Cheap !
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I think I'm going to try to use the channel selector approach. Using RE1 thru RE4 as the inputs. I read in the manual that there is a command that will sample the designated pins and store the result in a register of my chosing. The problem I am having trouble sorting out in my head is what should I do when the count goes back to 0000 after 1111 and vice versa. And still have the count continue up or down. Is there some way to like have a loop restart when this limit is reached?
Just messing with it as time allows. So not much progress. Still learnig the PBP commands and uses. And yes, got LED's blinking like crazy using machine code, but haven't tried it wih PBP yet.
Thanks for the helps Guys!
well let me say I think its the more complicated way, but hey that makes it more fun. I would guess you will have to read the count on the selector, compare it to the last count, If it is higher, add 1 to the freq, if its less subtract. To cross the zero, you will have 2 choices when at 0 of at $F. from o you will go to 1 or $F, and from $F you will go to 0 or $E. So just check for that when you get to those counts.
I would think you will have to really spin the selector VERY fast to miss any counts, so I would start with that scheme and see how it works. Don't forget you may need to de-bounce the inputs.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Thanks Bert. Should I use the IF...THEN string? Something like this;
Start
PEEK CHSEL CHSELVAR
IF CHSEL = 0000 THEN CHECK0
IF CHSEL = 1111 THEN CHECK1
ELSE LOOP
LOOP
PEEK CHSEL CHSELVAR
If CHSEL > CHSELVAR Then UP
Else
PEEK CHSEL CHSELVAR
IF CHSEL < CHSELVAR Then DOWN
Else
GOTO Start
UP
PLLDATA = PLLDATA +1
MOVLF PLLDATA PLLDATAOUT
GOTO Start
DOWN
PLLDATA = PLLDATA -1
MOVLF PLLDATA PLLDATAOUT
GOTO Start
CHECK0
IF CHVAR = 0001 THEN UP
IF CHVAR = 1111 THEN DOWN
ELSE LOOP
CHECK1
IF CHVAR = 0000 THEN UP
IF CHVAR = 1110 THEN DOWN
ELSE LOOP
Of course I didn't include all the defines. Am I on the right track?
Bookmarks