PDA

View Full Version : Gpio ? Trisio ?



ultiblade
- 15th October 2008, 11:22
Hi there,

I'm kind of stuck on this. A few weeks ago i made a RC5 IR to 10F202 receiver. All
worked fine. I decided that i need to store some counter values in eeprom, since the
10F does not have that, i decided to go with the 12F519.

I was used to set the IO functionality for the 10F trough the GPIO and TRISIO registers:


TRISIO = %00001000 'GPIO.3 = input only
GPIO = %00000000 'All low


In the 12F519 datasheet is says the tri-state register is called TRISGPIO and the GPIO register is called GPIO.

When i use TRISGPIO i get an syntax error, using TRIS or TRISIO also.
When i set a pin like: SDA VAR GPIO.1 i get an error : undefined symbol 'GPIO'

What am i missing ?

ultiblade
- 15th October 2008, 11:29
I think i figured it out, but i'm still confused ...

When i compile :


TRISB = %00111100 'Set TRIS register input's & output's
PORTB = %00000000 'Set all digital low

SDA var PORTB.0 'I2C DATA pin
SCL var PORTB.1 'I2C CLOCK pin


It compiles, without any errors !
How ?

sayzer
- 15th October 2008, 12:04
Change your PIC type to 12F519 in the menu above the program.

______________________

ultiblade
- 15th October 2008, 13:19
Thought of that, checked just yet it is 12F519 ... So that's not it ....

Acetronics2
- 15th October 2008, 14:17
Hi,

The truth is always Here :



'************************************************* ***************
'* 12F519.BAS *
'* *
'* By : Leonard Zerman, Jeff Schmoyer *
'* Notice : Copyright (c) 2007 microEngineering Labs, Inc. *
'* All Rights Reserved *
'* Date : 06/26/07 *
'* Version : 2.50 *
'* Notes : *
'************************************************* ***************

BANK0 $0007, $001F
BANK1 $0030, $003F
EEPROM $0400, $043F
LIBRARY "PBPPIC12"
DEFINE CODE_SIZE 400h

include "PIC12EXT.BAS"

TRISB VAR BYTE BANK0 SYSTEM ' TRISB shadow register

PORTL VAR PORTB
PORTH VAR PORTB
TRISL VAR TRISB
TRISH VAR TRISB

include "PBPPIC12.RAM"

'*----------------------* EOF 12F519.BAS *----------------------*



Have a look to the "1xYzzz".bas file in your PBP Directory. ( 1xYzzz = 12F519, here )

You can modify it or add Other Aliases ... at your own risks !

for 10F :



'************************************************* ***************
'* 10F206.BAS *
'* *
'* By : Leonard Zerman, Jeff Schmoyer *
'* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
'* All Rights Reserved *
'* Date : 06/04/04 *
'* Version : 2.46 *
'* Notes : *
'************************************************* ***************

BANK0 $0008, $001F
LIBRARY "PBPPIC12"
DEFINE CODE_SIZE 200h

include "PIC12EXT.BAS"

TRISIO VAR BYTE BANK0 SYSTEM ' TRISIO shadow register

PORTL VAR GPIO
PORTH VAR GPIO
TRISL VAR TRISIO
TRISH VAR TRISIO

include "PBPPIC12.RAM"

'*----------------------* EOF 10F206.BAS *----------------------*


Alain

ultiblade
- 15th October 2008, 14:38
You're so right !

Thanks, all clear now !