reading  I/O ports problems

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

reading  I/O ports problems

2,654 次查看
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: 
 
标签 (1)
标记 (1)
0 项奖励
回复
3 回复数

1,419 次查看
LEGION55
Contributor I
oops ....please is in assembly not in c or c++ thanks
0 项奖励
回复

1,419 次查看
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).
 
 
 

1,419 次查看
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,