Jump to content
ELFORUM - Forumul electronistilor
Guest narcis

de ce nu merge?

Recommended Posts

Guest narcis

Am facut un program in bascom in care daca apas pe buton sa se aprinda un led daca nu sa ramana stins, intrebarea mea este de ce nu merge...? Pana acum nu am reusit sa lucrez cu "input" si nu stiu care e cauza. Am citit si pe net am activat zic eu si pull-up am incercat si cu rezistor extern tot nu a mers. Mai trebuie setat ceva? Eu folosesc un atmega8, programul este urmatorul:$regfile = "m8def.dat"$crystal = 12000000Config Portd = OutputConfig Portc = InputPortc = &B1000 'activare pull-upMain:If Portc.3 = 0 ThenPortd.1 = 0ElsePortd.1 = 1End IfGoto MainVa multumesc de ajutor

Link to comment
Share on other sites

Am facut un program in bascom in care daca apas pe buton sa se aprinda un led daca nu sa ramana stins, intrebarea mea este de ce nu merge...? Pana acum nu am reusit sa lucrez cu "input" si nu stiu care e cauza. Am citit si pe net am activat zic eu si pull-up am incercat si cu rezistor extern tot nu a mers. Mai trebuie setat ceva? Eu folosesc un atmega8, programul este urmatorul:$regfile = "m8def.dat"$crystal = 12000000Config Portd = OutputConfig Portc = InputPortc = &B1000 'activare pull-upMain:If Portc.3 = 0 ThenPortd.1 = 0ElsePortd.1 = 1End IfGoto MainVa multumesc de ajutor

M-am jucat cu un Attiny2313 si m-am confruntat cu aceasi problema, la mine a mers cu comanda "If PIND.4 = 0 then..." adica in loc de If PORTD a mers If PIND nu stiu de ce dar asa a mers, poate merge si la tine.
Link to comment
Share on other sites

da merge cred ca asta era problemamersi multraman dator

Probabil ca ai observat deja daca nu vezi ca atunci cind se asteapta apasarea unui buton baga-i un pic de temporizare altfel i-ti aiureaza la apasarea butonului, ceva de genul:$regfile = "m8def.dat"$crystal = 12000000Config Portd = OutputConfig Portc = InputPortc = &B1000 'activare pull-upMain:If Portc.3 = 0 ThenPortd.1 = 0waitms 200 ElsePortd.1 = 1End IfGoto Main
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines