Justo ayer me puse con un QG8 a probar su uso con Cristal de 4Mhz. Los números que vos decís estarían bien, siempre y cuando tengas "bypasedd" el FLL (o sea, no lo usas) y el divisor del clock valga 1. Para hacer esto, yo usé el Device Initialization (parte del Processor Expert) y Seleccioné:
Source CPU Clock: External clock
External Clock : Enable
Clock Frequency (Mhz): 4,0Mhz
Bus Freq. divider: 1
FLL mode: Bypessed
Haciendo esto, cuando generás código ("automáticamente", haciendo clic en el botón "Generate Code"), te crea la rutina MCUinit con las siguientes líneas:
;** ###################################################################
;** This code is generated by the Device Initialization Tool.
;** It is overwritten during code generation.
;** USER MODIFICATION ARE PRESERVED ONLY INSIDE INTERRUPT SERVICE ROUTINES
;** OR EXPLICITLY MARKED SECTIONS
;**
;** Project : DeviceInitialization
;** Processor : MC9S08QG8CPB
;** Version : Component 01.262, Driver 01.08, CPU db: 3.00.012
;** Datasheet : MC9S08QG8 Rev. 4 2/2008
;** Date/Time : 2013-12-14, 14:39, # CodeGen: 3
;** Abstract :
;** This module contains device initialization code
;** for selected on-chip peripherals.
;** Contents :
;** Function "MCU_init" initializes selected peripherals
;**
;** Copyright : 1997 - 2011 Freescale Semiconductor, Inc. All Rights Reserved.
;**
;** http :
www.freescale.com;** mail : support@freescale.com
;** ###################################################################
; MODULE MCUinit
INCLUDE MC9S08QG8.inc ; I/O map for MC9S08QG8CPB
; User declarations and definitions
; Code, declarations and definitions here will be preserved during code generation
; End of user declarations and definitions
CODE_SECT: SECTION
XDEF MCU_init
;** ===================================================================
;** Method : MCU_init (component MC9S08QG8_16)
;**
;** Description :
;** Device initialization code for selected peripherals.
;** ===================================================================
MCU_init:
; ### MC9S08QG8_16 "Cpu" init code ...
; Common initialization of the write once registers
; SOPT1: COPE=0,COPT=1,STOPE=0,BKGDPE=1,RSTPE=0
LDA #$52
STA SOPT1
; SPMSC1: LVDF=0,LVDACK=0,LVDIE=0,LVDRE=1,LVDSE=1,LVDE=1,BGBE=0
LDA #$1C
STA SPMSC1
; SPMSC2: PDF=0,PPDF=0,PPDACK=0,PDC=0,PPDC=0
CLRA
STA SPMSC2
; SPMSC3: LVDV=0,LVWV=0
LDA SPMSC3
AND #$CF
STA SPMSC3
; System clock initialization
;Test if the device trim value is stored on the specified address
LDA $FFAF
CBEQA #$FF, SkipTrim
; ICSTRM: Initialize internal clock trim from a non volatile memory
LDA $FFAF
STA ICSTRM
; ICSSC: Initialize internal clock trim from a non volatile memory
LDA $FFAE
STA ICSSC
SkipTrim:
; ICSC2: BDIV=0,RANGE=1,HGO=0,LP=0,EREFS=1,ERCLKEN=1,EREFSTEN=0
MOV #$26,ICSC2 ; Initialization of the ICS control register 2
while_Cpu0: ; Wait until external reference is not stable
BRCLR 1,ICSSC,while_Cpu0
; ICSC1: CLKS=2,RDIV=7,IREFS=0,IRCLKEN=0,IREFSTEN=0
MOV #$B8,ICSC1 ; Initialization of the ICS control register 1
; Common initialization of the CPU registers
; PTASE: PTASE4=1,PTASE3=1,PTASE2=1,PTASE1=1,PTASE0=1
LDA PTASE
ORA #$1F
STA PTASE
; PTBSE: PTBSE7=1,PTBSE6=1,PTBSE5=1,PTBSE4=1,PTBSE3=1,PTBSE2=1,PTBSE1=1,PTBSE0=1
LDA #$FF
STA PTBSE
; PTADS: PTADS5=0,PTADS4=0,PTADS3=0,PTADS2=0,PTADS1=0,PTADS0=0
CLRA
STA PTADS
; PTBDS: PTBDS7=0,PTBDS6=0,PTBDS5=0,PTBDS4=0,PTBDS3=0,PTBDS2=0,PTBDS1=0,PTBDS0=0
CLRA
STA PTBDS
; ### Init_TPM init code
; TPMSC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0
CLR TPMSC ; Stop and reset counter
LDHX #$2710
STHX TPMMOD ; Period value setting
LDA TPMSC ; Overflow int. flag clearing (first part)
; TPMSC: TOF=0,TOIE=1,CPWMS=0,CLKSB=0,CLKSA=1,PS2=0,PS1=0,PS0=0
MOV #$48,TPMSC ; Int. flag clearing (2nd part) and timer control register setting
; ### Init_GPIO init code
; PTBD: PTBD5=0,PTBD4=0,PTBD3=0,PTBD2=0,PTBD1=0,PTBD0=0
LDA PTBD
AND #$C0
STA PTBD
; PTBDD: PTBDD5=1,PTBDD4=1,PTBDD3=1,PTBDD2=1,PTBDD1=1,PTBDD0=1
LDA PTBDD
ORA #$3F
STA PTBDD
; ###
CLI ; Enable interrupts
RTS
;** ===================================================================
Ok, espero te sirva de algo, o le sirva a otro que quiera hacerlo...
Saludos