CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Write and read in the EEPROM of the PIC by means of buttons

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
emazzu630



Joined: 14 Aug 2018
Posts: 20
Location: Ouro Verde - SC

View user's profile Send private message

Write and read in the EEPROM of the PIC by means of buttons
PostPosted: Sun Dec 30, 2018 7:55 am     Reply with quote

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
temtronic



Joined: 01 Jul 2010
Posts: 9232
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 30, 2018 8:13 am     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Sun Dec 30, 2018 8:39 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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