Port B input - HCS08QB4

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

Port B input - HCS08QB4

Jump to solution
1,712 Views
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
Labels (1)
0 Kudos
1 Solution
416 Views
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.

 

View solution in original post

0 Kudos
4 Replies
416 Views
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 Kudos
416 Views
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 Kudos
417 Views
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 Kudos
416 Views
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 Kudos