Port B input - HCS08QB4

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

Port B input - HCS08QB4

ソリューションへジャンプ
2,647件の閲覧回数
DRichards
Contributor III

I am using an HCS08QB4. I have switch inputs on PTB0-3 and PTB5-7. PTB0-3 and PTB5 are working fine, but PTB6-7 are always reading 0. I have set PTBDD and PTBPE. The two non-working inputs are labelled PTB7/EXTAL and PTB6/XTAL. I am not using an external crystal, but how does the chip know this to use the port pins?

 

 

 

Added p/n to subject.

Message Edited by NLFSJ on 2009-08-18 10:03 AM
ラベル(1)
0 件の賞賛
返信
1 解決策
1,351件の閲覧回数
DRichards
Contributor III

I've answered my own question by looking at the clock control registers. ICSC2 was being set to 0x47 in a demo program and I had copied this without a proper examination. I have changed this back to ICS2 = 0x40 (which is the default) and the external clock is now deselected. The PTB pins are now working correctly as inputs.

 

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,351件の閲覧回数
bigmac
Specialist III

Hello,

 

The internal oscillator should be used out of reset (default 4MHz).  This is controlled by the OSCOPT0 and OSCOPT1 bits within the OSCSC register.

 

Regards,

Mac

 

0 件の賞賛
返信
1,351件の閲覧回数
DRichards
Contributor III

I have the reference manual for the MC9S08QB and this does not include OSCOPT0, OSCOPT1 or OSCSC. The available registers are ICSC1, ICSC2, ICSTRM and ICSSC. The clock source select is the top two bits of ICSC1.

I am using the internal clock

    ICSC2 = 0x47;

    ICSC1 = 0x07;  // Internal clock
What I am asking is, are PTB7 and PTB6 available to use as ports as long as the external clock has not been selected or is there another set-up to be done apart from the data direction and pull-ups? Remember, PTB0-3 and PTB5 work. (PTB4 is an output and has not been tested).

0 件の賞賛
返信
1,352件の閲覧回数
DRichards
Contributor III

I've answered my own question by looking at the clock control registers. ICSC2 was being set to 0x47 in a demo program and I had copied this without a proper examination. I have changed this back to ICS2 = 0x40 (which is the default) and the external clock is now deselected. The PTB pins are now working correctly as inputs.

 

0 件の賞賛
返信
1,351件の閲覧回数
bigmac
Specialist III

Hello,

 

Sorry, I misread the device you are using as the HC908QB4, rather than the HCS08QB4. It gets a bit confusing at times.

 

Regards,

Mac

 

Message Edited by bigmac on 2009-08-15 02:06 PM
0 件の賞賛
返信