Thanks. of course Darrel would be the one to find something that obscure. Bet there's a story and some lost hours on that one.
Mark
Thanks. of course Darrel would be the one to find something that obscure. Bet there's a story and some lost hours on that one.
Mark
I have experienced this probably 50% of the time I have attempted to use toggle, High & Low commands and as such do not even attempt to use them.
Is there a definite cause / effect or relationship to their failure to work and setting TRIS registers? Can anyone point to a paragraph in the manual?
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.
from the pbp3 manual for HIGHits also mentioned for other commandsHIGH Pin
Make the specified Pin high. Pin is automatically made an output. Pin may be a constant, 0-15, or a variable that contains a number 0-15 (e.g. B0) or a pin name (e.g. PORTA.0).
HIGH 0 ' Make Pin0 an output and set it high (~5 volts)
HIGH PORTA.0 ' Make PORTA, pin 0 an output and set it high (~5 volts)
led Var PORTB.0 ' Define LED pin
HIGH led ' Make LED pin an output and set it high (~5 volts)
Alternatively, if the pin is already an output, a much quicker and shorter way (from a generated code standpoint) to set it high would be:
PORTB.0 = 1 ' Set PORTB pin 0 high
Since this command automatically sets the data-direction of the pin it acts on, the Pin parameter should only be a PORT or GPIO register (or an alias to a PORT or GPIO register). If the command is directed to act upon a LAT output or a bit within a variable or SFR, it will attempt to set a data-direction register that doesn't exist. The result may be unexpected behavior since a bit is changed in a seemingly random memory location. This can be very difficult to debug.
Last edited by richard; - 9th August 2014 at 05:13. Reason: pbp3
Ok I did some testing and I found:
1. High & Low worked without Tris or Ports set or analog settings set to digital
2. Setting port to 1 and zero worked with Tris & Ports set without analog settings set to digital
3. Toggle would not work without setting the analog stuff to digital, but when properly set it did.
it otherwise would go high and stay high.
Test chip 16F690 on Microchip demo board
Interesting, Since Both posters are using portA in their examples I think some analog register is blocking it working.
Which is what Mackrackit alluded to in post #3, I found it interesting it did not affect #2 in my test.
HTH
JS
Last edited by Archangel; - 9th August 2014 at 07:40.
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.
looks like I went off on the wrong path again, but I'd say archangel is 100% correct . if only people would post their complete code (or complete compilable example demonstrating the problem) speculation would be unnecessary,
dream on
According to data sheet 18F4620 making one port analog makes all smaller number ports analog which interferes with TOGGLE. IF AN5 is analog then AN0 thru AN4 are also analog, like a pyramid. TOGGLE is not needed. Adding a bit to an output pin toggles that pin, analog or not.
Bookmarks