reading  I/O ports problems

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

reading  I/O ports problems

1,725 Views
LEGION55
Contributor I
hi guys thanks for your help. look I'm new in this and Im working with the gp32 from hc08 family and I need to read from the port a and the port b two numbers, the question is
 
how can I read from the the ports of the gp 32 and save the data in the register A, and how can I write some value in the some port?.
thanks  I work with codewarrior 6.0
please help me!! :smileysad: 
 
Labels (1)
Tags (1)
0 Kudos
3 Replies

490 Views
LEGION55
Contributor I
oops ....please is in assembly not in c or c++ thanks
0 Kudos

490 Views
jorge
Contributor II
LEGION55>
 
Since you didn't show any code, it couldn't be considered as a problem itself.
 
Did you configured your I/O ports?
Are you reading incorrect or spurious values?
Do you write something to your port but you can't see anything?
Which I/O port or device are you using?
 
I think this task could be accomplished by reading the "Parallel Input/Output Control" of your device's Reference Manual combined by a good reading in addressing modes (INH, DIR will be a good starting).
 
 
 

490 Views
fabio
Contributor IV
Hi Legion55,

What about:

LDA PTA    ; load A with the state of the PTA pins (remember to configure the pins to input mode)
STA PTB   ; store A into the PTB register (write on the PTB pins configured as outputs)

Remember that you need to configure the PTA and PTB pins to the desired mode (input or output) by writting into the DDRA (for port A) and DDRB (for port B). By default (after reset), all pins are inputs.

Best regards,