Hi guys

this is new one for me

i normally have run the cpus at 32Mhz or 64Mhz and the setting i have for the USART2 at those speeds has worked fine in the past and work on this device when i set it up for 32 or 64Mhz

but now i need to drop the power usage down as low as i can , which has ment droping the clock as low as i can for the application to work

as a result i have set the main cpu at 1mhz , and enabled the PPL to give me a 4Mhz cpu.

However my terminal now refuses to work ,at the lower speed , i do see some chrs on the terminal but they are rubbish so clearly the baud rate is a problem

when using the 32Mhz setting and tried other buad rate down to 9600 and works ok

but now trying the 4mhz i get nothing or sometime s just rubbish

any thoughts

Cheers

sheldon

Code:
DEFINE OSC 32                ' Timing referance for pause , pauseus commands
    DEFINE ADC_BITS 12          ' Number of bits in ADCIN result - Required for adcin command 
    DEFINE PULSIN_MAX 2000      ' Maximum counts( clock ticks) allowed before pulsin times out( 2000 ^ 1.25us =  2.5 ms)
    DEFINE HSER_PORT 2          ' Hser port 2 use 
    DEFINE HSER2_RCSTA 90h      ' Hser2 receive status init
    DEFINE HSER2_TXSTA 24h      ' Hser2 transmit status init
    DEFINE HSER2_BAUD 38400      ' Hser2 baud rate

when cpu at 4mhz have just droped the buad rate 4800

Code:
DEFINE OSC 4                ' Timing referance for pause , pauseus commands
    DEFINE ADC_BITS 12          ' Number of bits in ADCIN result - Required for adcin command 
    DEFINE PULSIN_MAX 2000      ' Maximum counts( clock ticks) allowed before pulsin times out( 2000 ^ 1.25us =  2.5 ms)
    DEFINE HSER_PORT 2          ' Hser port 2 use 
    DEFINE HSER2_RCSTA 90h      ' Hser2 receive status init
    DEFINE HSER2_TXSTA 20h      ' Hser2 transmit status init
    DEFINE HSER2_CLROERR 1      ' Clear overflow automatically
    DEFINE HSER2_BAUD 4800      ' Hser2 baud rate
other osc settings for 4mhz


Code:
   OSCCON   = %00110000     ' Select 1Mhz - using 1Mhz internal with PPLx4 in Config1H<3:0>  =  IDLEN =0 , 8Mhz , OSTS=0,RFIOFS=1,RC_Run (1x) OSC using PLL  
                            ' Bit 7 IDLEN =0 ( sleep mode when sleep instraction executed)
                            ' Bits 6-4 -  111 = 16Mhz , 110 = 8MHz ,101 = 4 MHz, 100 = 2MHz 011 = 1MHz
                            ' If INTTSRC=0 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = LF-INTOSC     (31.25Khz)
                            ' If INTTSRC=0 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = LF-INTOSC     (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = HF-INTOSC/512 (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = MF-INTOSC/16  (31.25Khz)
                            ' Note: INTSRC = OSCTUNE<7> and MFIOSEL = OSCCON2<0>
                            ' Bit 3 - OSTS = 0 - Osc startup time out  is ruinning from internal OSC ( HF, MF or LF-INTOSC) 
                            ' Bit 2 - HFIOFS =1 ( INTOSC Frq stable bit  -  1 = stable , 0 = not stable 
                            ' Bits 1-0 - 00= Dephalt Pri OSc ( OSC1/2 or HF-INTOSC with/without PLL set in FOSC,3:0> config1H <3.0>
                            '            01 = SOSC osc
                            '            1x = Internal osc ( LF, MF,HF-INTOSC)  
   
  ' OSCCON2 = $00            ' Bit 7 n/a , Bit 6 - SOSCRUN - Run status bit , Bit 5-4 n/a, 
                            ' Bit 3 = SOASCGO - Osc Start control bit 1 = OSC running , 0 = OSC shut off if no requests for it 
                            ' Bit 2 n/a , Bit 1 - MFIOFS 1= MFINTOSC stable  0 = Not stable 
                            ' Bit 0 MFIOSEL - 1 = MF-INTOSC replaces HF-ISTOSC Freq for 500Khz,250Khz,31.25KHz) 0 = MF-INTOSC not used 
  
   OSCTUNE = %01000000      ' Bit 7  - INTSRC - internal LF Source Select 1 = 31.25 from 16Mhz Internal /512 HF-INTOSC ) 0 = Internal 31khz OSC 
                            ' Bit 6 - PLLEN - 1 PLL enabled  , 0 = PLL disabled 
                            ' Bits 5-0 Frequancy callibaration 00000 = centre Frq