reading  I/O ports problems

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

reading  I/O ports problems

2,557件の閲覧回数
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,322件の閲覧回数
LEGION55
Contributor I
oops ....please is in assembly not in c or c++ thanks
0 件の賞賛
返信

1,322件の閲覧回数
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,322件の閲覧回数
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,