• 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.

PIC doesn't run with internal oscillator

Status
Not open for further replies.

camerart

Active Member
'16f684A xtl

Define CONF_WORD = 0x3f41 'XTL
Define CLOCK_FREQUENCY = 4 'Changed from 12
AllDigital

'Define SIMULATION_WAITMS_VALUE = 1 'SIMULATION ONLY

Define LCD_BITS = 4
Define LCD_DREG = PORTB
Define LCD_DBIT = 4
Define LCD_RSREG = PORTA
Define LCD_RSBIT = 2
Define LCD_RWREG = PORTA
Define LCD_RWBIT = 3
Define LCD_EREG = PORTA
Define LCD_EBIT = 4
Define LCD_READ_BUSY_FLAG = 1

Lcdinit 'Stalls here...Lcdinit commented out RA1 flashes.

loop:
'Lcdcmdout LcdClear
'Lcdout "WORKING!?"
'Lcdcmdout LcdLine2Home
'Lcdout "TEST"
Toggle RA1 'INDICATOR LED
WaitMs 100
Goto loop

The RA1 LED flashes with all the defines, but stalls if LCdinit, is in the set-up.
 

jjw

Member
The program looks now right.
Have you checked the display specifications ( delays etc. )?
You could try it without the busy flag, the compiler should generate correct delays.
Have you checked the wiring?
 

camerart

Active Member
Hi,

I added a 4.7K pull up resistor to PIN 3, this got the LED to flash with the program as it should be.

I put a logic probe on the 7 LCD pins, and they all seem to be firing.

I have the contrast full on, I assume the screen should still be able to be read, and not whited out?

As suggested by JJW my guess would be something to do with timing. I'll have to read up about it.
 

skimask87

Member
Ok...how about this...

Read the first line of your post #43.

Now go over and read the part number on your PIC installed on the board.

Point being you've got half a dozen different PICs mentioned here...
16F819, 16F628A in a picture, PIC16F684 in the code, looks like it's wired up for a 16F648A.
 
Last edited:

camerart

Active Member
Are you still in the simulator? As it works in the IDE.... Make sure you have a resistor on RA4 as there is no internal pullup on this output!!
I've been using the simulator as a guide, then putting it in the circuit. It has a 4.7K resistor on RA4.
 

camerart

Active Member
Ok...how about this...

Read the first line of your post #43.

Now go over and read the part number on your PIC installed on the board.

Point being you've got half a dozen different PICs mentioned here...
16F819, 16F628A in a picture, PIC16F684 in the code, looks like it's wired up for a 16F648A.
Look at #11, It's been 16F648A since then.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
If you are going to drop the busy flag polling.... Then you have to tie RW to ground....

0x3f41 is correct if you have a 4Mhz crystal... There doesn't seem to be anything wrong with your code so you need to look at your connections....
 

camerart

Active Member
If you are going to drop the busy flag polling.... Then you have to tie RW to ground....

0x3f41 is correct if you have a 4Mhz crystal... There doesn't seem to be anything wrong with your code so you need to look at your connections....
Hi all,

I checked over and over, then tried a continuity test between each pin against all the pins. PIN1 showed it was connected to 5V.

At the bottom of the board 100mm from the circuit, I have the power connection, and a +V link across the board. So the copper line was connected all the way the up board to pin 1.

Sorry for time wasted, I was warned!!

It is working ok now.

Thanks to everyone who helped me, and once again apologies.

Camerart
 

Inquisitive

Super Moderator
Enquiring minds want to know. What was it?
 

Inquisitive

Super Moderator
It happens to us all. Glad you got it solved.
 

camerart

Active Member
It happens to us all. Glad you got it solved.
Thanks.

I had tested it with a logic probe, but it sounded to me as if PIN1 was working ok. I found it when I did a test of each pin against every other pin, which for me is not usual.

Cheers, Camerart.
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top