Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Hserout in Oshonsoft causing unrecognisable digits

Status
Not open for further replies.
Just run it up on ISIS and setting OSCCON to 8Mhz and PLL to on... I'm getting 125nS instructions and 1.0004 seconds on the 1000ms delay..
It would appear 4 instructions too many, but close enough... Pic running at 32Mhz...
 
Just run it up on ISIS and setting OSCCON to 8Mhz and PLL to on... I'm getting 125nS instructions and 1.0004 seconds on the 1000ms delay..
It would appear 4 instructions too many, but close enough... Pic running at 32Mhz...
Hi I,
Ok, I'll try this later, thanks.

With the ON/OFF program I posted, would you expect the PIN37 SCK, to switch 0-3.3V, it is actually only outputting 0.5V when ON.

C.
 
Hi I,
OK.
Initially I tried to get PICs running at 32MHz, but after failing, I use 8MHz and no PLLEN till things get working,
Thanks.
C.
PLL enable bit for the internal oscillator is in the OSCTUNE register, not in CONFIG1H
 
PLL enable bit for the internal oscillator is in the OSCTUNE register, not in CONFIG1H
Hi I,
I tried the OSCTUNE one and this one:
C.
 

Attachments

  • Config.jpg
    Config.jpg
    145.4 KB · Views: 332
Hi,
I've been concentrating on the SCK PIN. When simple PORT ON/OFF the SCK shows 0-0.5V

I don't think it is switching correctly.
C.
 
The settings I used were the internal 8Mhz boosted to 32Mhz... Switching the PLLEN in the OSCTUNE on... JJW is right. You have to use internal setting..

HS with PLL is for the external crystal... CONFIG1H = 0x6.. PLL is always enabled
Internal fast RC... CONFIG1H = 0x8.. PLL has to be enabled in software.
 
Hi,
Looking at the program I'm using for these tests #16 all the setting are as you are all saying: 8MHz no PLLEN. Let me know if I'm incorrect.
Note: in Oshonsoft ( ' ) = commented out.
C.
 
Hi,
Looking at the program I'm using for these tests #16 all the setting are as you are all saying: 8MHz no PLLEN. Let me know if I'm incorrect.
Note: in Oshonsoft ( ' ) = commented out.
C.
Never said that! I used 8Mhz internal with the PLL enabled...
Code:
'18LF46k20 8Mhz RX 2XPIC HC-12 AK8963C 271118 1600 PCB TEST
'R= HC-12, G= GPS, A=ALT, C=COMPASS, S=SCREEN.    (1 BEGINNING OF SECTION 2 END OF SECTION)
Define CONFIG1L = 0x00
Define CONFIG1H = 0x08  'INT OSC
'Define CONFIG1H = 0x06  'HS OSC PLL EN CLK = 4 X FOSC1 [[[Doesn't work ????]]]
Define CONFIG2L = 0x1e
Define CONFIG2H = 0x00
Define CONFIG3L = 0x00
Define CONFIG3H = 0x81  'Set for HVP
Define CONFIG4L = 0x80
Define CONFIG4H = 0x00
Define CONFIG5L = 0x0f
Define CONFIG5H = 0xc0
Define CONFIG6L = 0x0f
Define CONFIG6H = 0xe0
Define CONFIG7L = 0x0f
Define CONFIG7H = 0x40
'Define SIMULATION_WAITMS_VALUE = 1  'Comment in for SIM out for PIC
Define CLOCK_FREQUENCY = 32
Define SINGLE_DECIMAL_PLACES = 2
Define STRING_MAX_LENGTH = 70  'Needs setting to fit the whole NMEA or BASE sentence for transmit>>>>>>>>>>
AllDigital
'SET PIN IN/OUT
TRISA = %00000000  '7=XTL 6=XTL 5=0=Slave select
TRISB = %00000000  '7=PGD 6=PGC 543210 OLD SERVOS
TRISC = %10010000  '7=RX=1 6=RX=0 5=SDO 4=SDI=1 3=SCK=0 1=LCD5110 RST=0 0=LCD5110 DATA=1 COMMAND=0
TRISD = %00000011  '7=RX SWITCH 6=CS3 COMPASS 5=CS2 altmtr c/s=0 4=CS1 lcd5110 c/s=0 3=SET HC-12 C/S=0 1=18lf2520 READY 0=18lf2520 ERROR
TRISE = %00000100  '2=Button 1=RlED 0=YLED
'SET BITS ON/OFF
PORTA = %00000000  'ON/OFF
PORTB = %00000000
LATB = 0
PORTC = %00000000
PORTD = %11110000  'ALL C/S HIGH
PORTE = %00000000  'POSS MCLR RE3
WaitMs 10

OSCCON = %01110110
OSCTUNE.PLLEN = 1


'SPI
''Define SPI_CS_REG = PORTD [USED WHEN IN SLAVE MODE]
''Define SPI_CS_BIT = 4[USED WHEN IN SLAVE MODE]
Define SPI_SCK_REG = PORTC
Define SPI_SCK_BIT = 3
Define SPI_SDI_REG = PORTC  'not used, but left in so OSH does not burp
Define SPI_SDI_BIT = 4
Define SPI_SDO_REG = PORTC
Define SPI_SDO_BIT = 5
SPIPrepare

Symbol yled = LATE.0
Symbol rled = LATE.1

main:

PORTA = 255
PORTB = 255
PORTC = 255
PORTD = 255
PORTE = 255
WaitMs 1000
PORTA = 0
PORTB = 0
PORTC = 0
PORTD = 0
PORTE = 0
WaitMs 1000

Goto main
 
Hi All,
I've got to apologise. From around #16, I got a bit mixed up between two different problems.

The Programs are now showing recognisable digits. I just happen to have left the settings 8MHz and no PLLEN, for now, while I sort out the second problem.

The SPI, SCK PIN is not switching ON/OFF as it should. I'll post another thread.

Thanks,
C.
 
Last edited:
Never said that! I used 8Mhz internal with the PLL enabled...
Code:
'18LF46k20 8Mhz RX 2XPIC HC-12 AK8963C 271118 1600 PCB TEST
'R= HC-12, G= GPS, A=ALT, C=COMPASS, S=SCREEN.    (1 BEGINNING OF SECTION 2 END OF SECTION)
Define CONFIG1L = 0x00
Define CONFIG1H = 0x08  'INT OSC
'Define CONFIG1H = 0x06  'HS OSC PLL EN CLK = 4 X FOSC1 [[[Doesn't work ????]]]
Define CONFIG2L = 0x1e
Define CONFIG2H = 0x00
Define CONFIG3L = 0x00
Define CONFIG3H = 0x81  'Set for HVP
Define CONFIG4L = 0x80
Define CONFIG4H = 0x00
Define CONFIG5L = 0x0f
Define CONFIG5H = 0xc0
Define CONFIG6L = 0x0f
Define CONFIG6H = 0xe0
Define CONFIG7L = 0x0f
Define CONFIG7H = 0x40
'Define SIMULATION_WAITMS_VALUE = 1  'Comment in for SIM out for PIC
Define CLOCK_FREQUENCY = 32
Define SINGLE_DECIMAL_PLACES = 2
Define STRING_MAX_LENGTH = 70  'Needs setting to fit the whole NMEA or BASE sentence for transmit>>>>>>>>>>
AllDigital
'SET PIN IN/OUT
TRISA = %00000000  '7=XTL 6=XTL 5=0=Slave select
TRISB = %00000000  '7=PGD 6=PGC 543210 OLD SERVOS
TRISC = %10010000  '7=RX=1 6=RX=0 5=SDO 4=SDI=1 3=SCK=0 1=LCD5110 RST=0 0=LCD5110 DATA=1 COMMAND=0
TRISD = %00000011  '7=RX SWITCH 6=CS3 COMPASS 5=CS2 altmtr c/s=0 4=CS1 lcd5110 c/s=0 3=SET HC-12 C/S=0 1=18lf2520 READY 0=18lf2520 ERROR
TRISE = %00000100  '2=Button 1=RlED 0=YLED
'SET BITS ON/OFF
PORTA = %00000000  'ON/OFF
PORTB = %00000000
LATB = 0
PORTC = %00000000
PORTD = %11110000  'ALL C/S HIGH
PORTE = %00000000  'POSS MCLR RE3
WaitMs 10

OSCCON = %01110110
OSCTUNE.PLLEN = 1


'SPI
''Define SPI_CS_REG = PORTD [USED WHEN IN SLAVE MODE]
''Define SPI_CS_BIT = 4[USED WHEN IN SLAVE MODE]
Define SPI_SCK_REG = PORTC
Define SPI_SCK_BIT = 3
Define SPI_SDI_REG = PORTC  'not used, but left in so OSH does not burp
Define SPI_SDI_BIT = 4
Define SPI_SDO_REG = PORTC
Define SPI_SDO_BIT = 5
SPIPrepare

Symbol yled = LATE.0
Symbol rled = LATE.1

main:

PORTA = 255
PORTB = 255
PORTC = 255
PORTD = 255
PORTE = 255
WaitMs 1000
PORTA = 0
PORTB = 0
PORTC = 0
PORTD = 0
PORTE = 0
WaitMs 1000

Goto main
Hi I,
With the above program, the LEDs are now flashing 1 every 4Secs.
C.
 
That means your PLL isn't switching.. Per chance did you do a new config setting when you changed from the K to the normal? Different OSC settings..
Hi I,
I've simply been trying previous programs as they are, then trying different settings. I did try different setting, remember the HS example. It's now set to 0x08 INT OSC
C
 
I simulated it with define clock_frequency = 32 and got 1sec on 1sec off or blinking once in 2 seconds.
So your clock is 16MHz ?
The delay is 1 second so an on/off cycle is 2 seconds.. that would suggest 32Mhz as required...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top