|
|
| Author |
Message |
hakha4
Joined: 02 Jun 2009
Posts: 30
Location: Moholm Sweden
|
|
Posted: 09 September 2009, 18:40 PM Post subject: Interrupt in zx24 question |
|
|
Hi
I want to use interrupt with zx24 and the manual says 'Port A Bit 2 must be an input for this to work properly' . It's kind og elemantory but I can't figure out how,I've tried Call Putpin(pin18, zxInputPullUp) but I'm unsure if it works, Any help would be appreciated
Regards Hucke |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 09 September 2009, 19:36 PM Post subject: Re: Interrupt in zx24 question |
|
|
| hakha4 wrote: | | It's kind og elemantory but I can't figure out how [to make a pin an input]. I've tried Call Putpin(pin18, zxInputPullUp)[...] | That will definitely make A.2 an input but it will also enable the internal pullup resistor. Depending on the external circuitry, that may OK or not. To make A.2 an input without the pullup, use: | Code: | | Call Putpin(A.2, zxInputTriState) | The mode values for PutPin() are all described in the ZBasic System Library Reference Manual.
As a side note, all general purpose I/O pins are set to be inputs (with no pullup resistor) at startup. It doesn't hurt, however, to explicitly configure the I/O pins as you want them using PutPin(). |
|
| Back to top |
|
 |
hakha4
Joined: 02 Jun 2009
Posts: 30
Location: Moholm Sweden
|
|
Posted: 09 September 2009, 21:31 PM Post subject: |
|
|
| Thanks! |
|
| Back to top |
|
 |
stevech
Joined: 23 Feb 2006
Posts: 657
|
|
Posted: 11 September 2009, 6:25 AM Post subject: |
|
|
| don't overlook an AVR newbie common mistake: check difference between the PIN input register and the PORT input register. |
|
| Back to top |
|
 |
|