Author Topic: Flashing a Single LED to show ADC result.  (Read 2700 times)

0 Members and 1 Guest are viewing this topic.

Offline djsbTopic starter

  • Frequent Contributor
  • **
  • Posts: 893
  • Country: gb
Re: Flashing a Single LED to show ADC result.
« Reply #25 on: April 03, 2024, 04:34:58 am »
Thanks everyone for your replies.
My original motivation for asking this question is how can a complete beginner with both PIC microcontrollers and XC8 read the output of the ADC without using a UART or serial bit banging? Up to now serial has been trivial as we have used the CCS C compiler. XC8 is a bit more involved.
I'm writing code that builds GRADUALLY in complication and want to keep code as simple as possible and then build it up gradually.
I thought it would also be interesting as a thought experiment for a situation where a computer/serial link is not available.
I think using 4 different coloured LED's and then having them indicate 1000,100,10 and units would be the simplest method with a pause in between units. This would be for a 10 bit ADC result.
« Last Edit: April 03, 2024, 04:36:50 am by djsb »
David
Hertfordshire,UK
University Electronics Technician, London PIC,CCS C,Arduino,Kicad, Altium Designer,LPKF S103,S62 Operator, Electronics instructor. Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. Credited Kicad French to English translator.
 

Offline Retirednerd2020

  • Regular Contributor
  • *
  • Posts: 61
  • Country: us
Re: Flashing a Single LED to show ADC result.
« Reply #26 on: April 03, 2024, 06:42:06 pm »
I once designed in an led that flashed at a rate proportional to the charge level of an ultra-capacitor bank.  It took about 5 minutes to charge the bank.  About the time you have a seizure from watching the LED, the bank was charged.
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1327
  • Country: ca
Re: Flashing a Single LED to show ADC result.
« Reply #27 on: April 03, 2024, 07:29:14 pm »
My original motivation for asking this question is how can a complete beginner with both PIC microcontrollers and XC8 read the output of the ADC without using a UART or serial bit banging? Up to now serial has been trivial as we have used the CCS C compiler. XC8 is a bit more involved.

Personally, I don't think writing code to serial bit-bang the data is much more difficult that devising code to flash a single LED in a human readable pattern.
A simple LED flash pattern could be two short flashes for a ONE bit or a single short flash for a ZERO bit, then a pause and the next bit. Longer pause between 10bit words. That'd be pretty human readable combined with a pen and paper.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf