View previous topic :: View next topic |
Author |
Message |
emazzu630
Joined: 14 Aug 2018 Posts: 20 Location: Ouro Verde - SC
|
Write and read in the EEPROM of the PIC by means of buttons |
Posted: Sun Dec 30, 2018 7:55 am |
|
|
Preciso montar a estrutura do código para o seguinte problema:
"Em um determinado momento da contagem, clico no botao "REC" e no botao "MEM1" (os dois botoes precisam estar apertados) para armazenar o numero de 16 bits da contagem na memoria EEPROM interna do PIC. Posso prosseguir com a contagem, mas depois de um periodo de tempo, desejo voltar ao numero armazenado na EEPROM. Então clico apenas no botao "MEM1" e o numero é exibido no display. Toda a vez que "REC" e "MEM1" é clicado junto, o dado antigo é apagado e escrito o atual."
Essa é a logica que preciso desenvolver, o código que desenvolvi até agora, apenas grava ao clicar no botao "MEM1".
Last edited by emazzu630 on Sun Dec 30, 2018 8:23 pm; edited 7 times in total |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9181 Location: Greensville,Ontario
|
|
Posted: Sun Dec 30, 2018 8:13 am |
|
|
well 1st problem... NO 'REC' button !
2nd.. when uisng fast_io() YOU must tell the compiler which pins are inputs and which are outputs. For 99.999% of programs seen here it's best to use standard_io(), the default nd let the compiler handle those details.
'buttons'( switches) if, mechanical all have 'bounce' (multiple on/off conditions where pressed). you need some form of debouncing, either a HW filter (capacitor) or SW filter( a timer)
if all 'buttons' can be wired to the same I/O port, code can be easy.
read port, decode PB high or low ?, take action
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19387
|
|
Posted: Sun Dec 30, 2018 8:39 am |
|
|
Also understand that you are never going to actually hit the buttons 'at the
same time', in computer terms. Even if you pushed the buttons with one
finger, there would still be a few uSec difference between when the
processor would see them. |
|
![](templates/subSilver/images/spacer.gif) |
|