​ ​ ​ ​ 18X outputs (output6,7)as ADC inputs?
Results 1 to 8 of 8

Thread: 18X outputs (output6,7)as ADC inputs?

  1. #1
    Senior Member
    Join Date
    Jan 1970
    Location
    Groningen, The Netherlands
    Posts
    466

    Default 18X outputs (output6,7)as ADC inputs?

    Hello,

    Thanks to Hippy's investiations we now know that the 18X is more flexible than officially documented as it is possible (amongst others) to change its output pins into input pins. The PIC16F88 datasheet suggests that output6 & 7 when turned to inputs may actually be configured as ADC inputs, on the condition that the ADC control registers can be poked succesfully and are not overwritten by the PICAXE firmware.

    Has anybody tried to do this? The reason I ask is that I would like to use a LED as both a light emitting device as well as a light-level sensor using the ADC sensor (by reverse charging and then measuring the charge decrease over a 10ms time interval, see wilf_nv's contributions on this matter; he only uses logical levels, but I want to read the analog level)

    As an addition to the ADC question, has anyone tried whether the weak pullups can be enabled when the output pins are defined as inputs as well?

    Of course I should have checked it myself, but I dont have the means right now

    Regards,
    Jurjen
    Last edited by kranenborg; 19-03-2008 at 21:42.

  2. #2
    Senior Member
    Join Date
    Jan 1970
    Location
    sydney,nsw,land of the slaves
    Posts
    1,120

    Default

    i doubt the interpreter will interfere too much as most of the setting up of all the modules is probably done upon startup,

    they would have forseen that people would want to be able to do stuff like this which is why they put in peek and poke
    "If you put the NSW State government in charge of the Simpson Desert, in 5 years there'd be a shortage of sand."

  3. #3
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,316

    Default

    Yes, output pins 6 and 7 work as ADC on the 18X. One needs to protect the 'input' when the pins are outputs but once setup, poke the SFR's, initiate an ADC 'GO' then read the result.

    I haven't tried weak pull-ups but cannot see any reason it wouldn't work. Interrupt On Change works ( no interrupt, but change can set the flag ), as does INT(RB0) which allows narrow pulses to be detected.

    The 18X is definitely my favourite PICAXE.

  4. #4

    Default

    Another great example of the need for an "Advanced" section where all these little peeks & pokes could be documented.

  5. #5

    Default

    Yes, this has been suggested/started/never-finished/forgotten about several times including fairly recently.

    A nice 'Data Sheet' entry would be nice showing SFR addresses etc and function would be nice - including brief examples.

    Maybe if someone wrote a nice neat .pdf document and asked Rev-Ed REALLY nicely they may include it.

    I'll volunteer hippy to write it, but get BeanieBots to edit it , to prevent a War and Peace sized document

  6. #6
    Senior Member
    Join Date
    Jan 1970
    Location
    Groningen, The Netherlands
    Posts
    466

    Default

    Hippy started a documentation thread (PICAXE SFR Usage): http://www.picaxeforum.co.uk/showthread.php?t=8954

    This thread can be found in the User Projects / Communication Area

    Probably best to let him document it, and not add any other comments to that thread

    I have made a proposal for sections in this forum earlier that may still be relevant (but it might be too much work to relocate all current messages): http://www.picaxeforum.co.uk/showthread.php?t=7698

    /Jurjen

  7. #7

    Default

    Thanks Jurgen. I'd forgotten where it went. Good stuff.

    But this is the point isn't it; my addled brain forgot where it is and Newbies /Oldbies wouldn't even look as they wouldn't know where to look (or couldn't be bovvered).

    It would be nice as a PICAXE Manual addition/supplement. A proper permanent reference with examples in addition to descriptions. Always there and always in your face and not a thread that disappears into the gentle filaments of time...

    Are you left-handed by the way?

  8. #8
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,316

    Default

    At some point I really should add all those short demo programs for using SFR and hardware trickery to the 'Finished Projects' section so they are not lost when the aliens take me away for a probing. I'll think about the best way of doing that.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •