|
|
View previous topic :: View next topic |
Author |
Message |
qoou
Joined: 28 Sep 2016 Posts: 14
|
|
Posted: Tue Oct 04, 2016 10:47 am |
|
|
Ttelmah wrote: | You are typing something wrong.
I tested the code as posted on your compiler version:
Code: |
#byte ANSELD=getenv("SFR:ANSELD")
void main()
{
ANSELD=0;
}
|
Remember '0', not 'O'. |
Your first post had ANSEL0 (zero); now changed to ANSELD (Delta).
Ttelmah wrote: | Code: | #byte ANSEL0=getenv("SFR:ANSEL0")
ANSEL0=0; |
|
I'm still confused either way.
This is the port D analog select register, correct? What's the purpose of setting this to 0, which I believe is setting the pins RD0-RD2 to digital I/O?
Ttelmah wrote: | If you look at the data sheet again, after the stuff for port's A, B & C, there is a separate section for the port D and port E registers with the comment "PIC 16(L)F1784/7 only". Has ANSELD and E.
The compiler does handle most of this for you. However with your rather early compiler it is possible that there are faults here. |
Weird, I had downloaded a datasheet long ago; probably from Mouser when I bought the chip. It same some sections that are quite different than the version on Microchip. Particularly, it's missing the section on PortE, along with a few other things.
http://www.mouser.com/ds/2/268/41637B-254552.pdf
temtronic wrote: | 3) A 'static' LCD (direct drive, 8 pins per dgt) should NOT consume any real power while the PIC is asleep. It's the transitions (1>0, 0>1) that need energy. A PIC in sleep will 'keep' the last LCD reading on the LCD. Might be worth an hour's bench time to observe this... |
I must be confused on what a PIC can and cannot do in sleep mode. I had thought while in sleep, the PIC was unable to change the state of the I/O pins. How would I continue to drive the LCD without leaving a dc voltage on the LCD? I'm not using any external LCD driver module, just directly driving the LCD from I/O pins at 50Hz.
RF_Developer wrote: | Sleeping the PIC inbetween LCD toggles sounds like a good idea, but I doubt you'd be able to sync to the LCD signal. I too feel "go faster, in shorter bursts" is the way to go. |
Thanks! I really wasn't sure if toggling sleep mode that fast would be degrading.
At some point I will try toggling sleep between LCD refreshes. Though it will already run over a year on battery, and this is just a learning project. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Tue Oct 04, 2016 12:04 pm |
|
|
re: LCD
you should post the link to yours.. some,long ,long ago could be 'direct drive' as such didn't need a square wave (AC) to drive them. I still have a drawer full of 2 digit units.... these could left 'on' without damage to the LCD.
this did allow you to 'set' a number on the LCD and have the PIC 'go to sleep' which left the I/O pins in either a '1' or '0' condition and the digit would still be displayed.
depending on your LCD , this might be possible. there should be a spec about 'refresh rate' of segment drive or digit ????........
kinda important stuff in datasheets .
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Tue Oct 04, 2016 12:10 pm |
|
|
Quote: |
Your first post had ANSEL0 (zero); now changed to ANSELD (Delta).
|
No.
I write to both ANCON0, and ANSELD...... |
|
|
qoou
Joined: 28 Sep 2016 Posts: 14
|
|
Posted: Tue Oct 04, 2016 12:57 pm |
|
|
Ttelmah wrote: | Quote: |
Your first post had ANSEL0 (zero); now changed to ANSELD (Delta).
|
No.
I write to both ANCON0, and ANSELD...... |
I'm almost ready to believe that you're just trolling me?
-----
temtronic wrote: | re: LCD
you should post the link to yours.. some,long ,long ago could be 'direct drive' as such didn't need a square wave (AC) to drive them. I still have a drawer full of 2 digit units.... these could left 'on' without damage to the LCD.
this did allow you to 'set' a number on the LCD and have the PIC 'go to sleep' which left the I/O pins in either a '1' or '0' condition and the digit would still be displayed.
depending on your LCD , this might be possible. there should be a spec about 'refresh rate' of segment drive or digit ????........
kinda important stuff in datasheets .
Jay |
That would have to be an LCD module; not a static LCD. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Tue Oct 04, 2016 1:45 pm |
|
|
Well I've got a drawer of 2 digit LCD here, not 'modules', there are NO electronics just 18 pins (7 segments, dp and the common per digit ). I used them for a 2 digit temperature readout 20 years ago. They will operate in 'DC mode', meaning they do not have to be driven from an AC supply.
I'm sure the 'wording' has changed over the past 2 decades but I could set the digits I needed then let the PIC sleep without damaging the displays.
These days though I can buy 4x20 LCD modules for $5, designed for 5 volts but add a few components to run them on 3 volts. Heck, I can buy a complete single channel, 3 digit DVM for $5..sigh....
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 04, 2016 3:21 pm |
|
|
Yes but temtronic, you said in this earlier thread that running your lcds
that way will damage them:
temtronic wrote: | If you just tie it to ground then over time you'll 'burn'
the segments into the display, similar to CRTs and plasma displays. It
could take months of use though, all depends on how long a segment is
on for. |
https://www.ccsinfo.com/forum/viewtopic.php?t=50308&start=5
This Atmel appnote says:
Quote: |
The LCD must be supplied with AC signals, typically square waves. LCDs
will be damaged if supplied with static DC signals, and irreversible plating
of the segments will occur. |
AVR340: Direct Driving of LCD Using General Purpose IO.
http://www.atmel.com/images/doc8103.pdf |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Wed Oct 05, 2016 12:43 am |
|
|
However in this case, this could be avoided very easily by inverting the drives whenever the chip wakes. So it spends the period 'asleep', first showing phase1, and then on the next sleep using phase2 drive etc..
This is actually done on quite a few bits of super low power kit on the market, with the phase swapping every few seconds. You don't need a high rate of swap. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Wed Oct 05, 2016 5:24 am |
|
|
yes... running 'new' technology LCD in 'static' or 'DC' mode will destroy the units over time but...the ones I was using 25+ years ago were designed (or at least worked fine) for years. I've long since tossed out most of my paper databooks (enough to fill a whole room) as 'everything' is now on the Internet, somewhere.....
They were 'refreshed' probably every 5 or 10 seconds (temperature reading doesn't need microsecond updating). Yeesh, that project is 1/4 century old..great now I feel old ...
That's why it's kinda important to read the entire spec sheet on whatever devices you're using. The choices for chips is HUGE these days, prices are ridiculously cheap, sad thing is the plastic BOXES cost MORE than the PICs we put in them!
Jay |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|