PDA

View Full Version : "hello world" with 18f6680



dragons_fire
- 22nd December 2007, 06:51
i know someone is going to say something about reading the datasheet, or looking in the manual, but im having some trouble with this, and im sure its just something small.

heres the code, and im flashing a LED on D.4 and setting all the config stuff in my programmer, since i cant figure out the defines.

<code>
DEFINE OSC20
PORT.4 = 0

start:
high PORTD.4
pause 500
Low PORTD.4
pause 500
goto start

end
</code>

the hardware is a PIC18F6680, with a LED and resistor connected to ground.

the config fuses HS OSC, brownout 2.0v, watchdog enabled, lvp disabled

bbazor
- 22nd December 2007, 06:59
Could it be that you forgot to put a space between "OSC" and "20"?
Try changing DEFINE OSC20 to DEFINE OSC 20.

Ben

mister_e
- 22nd December 2007, 13:12
don't tell us what your problem is in case we could help ;)

dragons_fire
- 22nd December 2007, 16:25
yeah, i guess i should mention whats happening or not happening...

so the LED doesnt light up, ive checked for voltage with my meter and theres nothing from the pin to ground..

i should also mention that i caught that missing space (OSC 20) right after i posted, but it still didnt help... the hardware should be good, i think im jsut missing something in the software.

dragons_fire
- 23rd December 2007, 17:24
ok, here is the last version of my code... still cant get it to work...

<code>

DEFINE OSC 20

TRISA = 0
TRISB = 0
TRISC = 0
TRISD = 0
TRISE = 0
TRISF = 0
trisg = 0

LCDA1 VAR PORTE.6
LCDB1 VAR PORTE.7
LCDC1 VAR PORTE.3
LCDD1 VAR PORTG.4
LCDE1 VAR PORTG.3
LCDF1 VAR PORTE.5
LCDG1 VAR PORTE.4
LCDDP1 VAR PORTG.2

LCDA2 VAR PORTD.2
LCDB2 VAR PORTD.3
LCDC2 VAR PORTE.0
LCDD2 VAR PORTG.0
LCDE2 VAR PORTG.1
LCDF2 VAR PORTD.1
LCDG2 VAR PORTD.0
LCDDP2 VAR PORTE.1

LCDA3 VAR PORTD.6
LCDB3 VAR PORTD.7
LCDC3 VAR PORTB.0
LCDD3 VAR PORTB.1
LCDE3 VAR PORTE.2
LCDF3 VAR PORTD.5
LCDG3 VAR PORTD.4

pause 500

'MAIN PROGRAM\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

start:
high LCDa1
high LCDb1
high LCDc1
high LCDd1
high LCDe1
high LCDf1
high LCDg1
high LCDdp1

high LCDa2
high LCDb2
high LCDc2
high LCDd2
high LCDe2
high LCDf2
high LCDg2
high LCDdp2

high LCDa3
high LCDb3
high LCDc3
high LCDd3
high LCDe3
high LCDf3
high LCDg3

pause 500
low LCDa1
low LCDb1
low LCDc1
low LCDd1
low LCDe1
low LCDf1
low LCDg1
low LCDdp1

low LCDa2
low LCDb2
low LCDc2
low LCDd2
low LCDe2
low LCDf2
low LCDg2
low LCDdp2

low LCDa3
low LCDb3
low LCDc3
low LCDd3
low LCDe3
low LCDf3
low LCDg3
pause 500
goto start
end
</code>

so it powers up, but it doesnt put and of the ports high.. there is only one LED connected, the rest of the pins arent connected. but i have put my meter across them to see if there is any voltage...

mister_e
- 23rd December 2007, 20:42
3 things,
no configuration fuses.. make sure you set the right osc mode
disable all multiplexed analog converter, comparator, voltage reference or else fancy stuff
with 18Fs, you want to use LAT instead of PORT to avoid R-M-W behaviour. The best solution is often write to the whole port in one shot instead of using multiple High/Low lines.

dragons_fire
- 23rd December 2007, 21:42
ok....

1. i wasn't sure how to set the fuses before, but since then i have discovered the .inc file, and i have changed them in there. if i try to add it to the code too, it says I'm overwriting code space.

2. i knew i had to do that... i just forgot...

3. i have never even heard of LAT.. is it in the manual? i had a quick look but couldn't find it there. and when you say write the whole port instead of multiple lines, do you mean all of portb at a time? or am i missing something??

thanks for the help.. i tried using a PIC18F before, and ran into a lot of problems too, so i put that project on hold for a while and went back to 16F's...

heres the thread about the Robot i built using a PIC18F6585.. http://www.picbasic.co.uk/forum/showthread.php?t=6119&highlight=treadbot

Darrel Taylor
- 23rd December 2007, 22:17
Awwwww,

I wondered what happened to the Treadbot.

Poor little guy. Back-burners such a lonely place. (except at my house, lot's of company there) :)

Hope you get back to it some day.
And I hope I can help out more when you do.
<br>

dragons_fire
- 23rd December 2007, 22:24
yeah, it seemed to work until the motors got up to a certain speed, adn then it would just freeze.. i started this "project" just to learn the 18f

b1arrk5
- 24th December 2007, 22:45
If you put +5vdc on portd.4 does the LED light? If not then it's a hardware problem, if it does then try something really simple like;

DEFINE OSC 20
HIGH PORTD.4
END

Did the port go high? I took a quick look at the datasheet for you PIC, and I didn't see that PortD.4 is multiplexed, so it should work fine.

LAT is not in the manual, it is in the datasheet, it's a memory register, you've probably seen it as LATA, or LATB, etc.

Usually when I have this problem it's because I put the LED in backwards, even though I checked it three times before I soldered it.

Merry Christmas!

Jerry.

dragons_fire
- 24th December 2007, 23:10
i have actually made d.4 an I/O connection on my board.. there is three pins, ground, + and signal (just like a servo). so i had an LED hooked to it, but since then, i have just hooked up my multimeter, and its not showing any voltage across signal to ground when i put it high. i do get 5V across the + and ground. and i can write code to the PIC, and i can read the same code back off the PIC.. its a double stacked board, and i soldered the headers into both boards, so i may need to try to get them apart to look inside where the PIC is..

b1arrk5
- 25th December 2007, 02:37
Isn't that always the way? Hopefully you'll see something easy to fix when you get it opened up, it's got to be something simple. The 18F chips are great once you get the hang of them, just keep at it, and remember, we do this for fun right?

Merry Christmas!

Jerry.

dragons_fire
- 1st January 2008, 06:25
i did find one little thing... one pin from my OSC was touching a 5V line... so i fixed that, but im still not getting any voltage on any pins...

mackrackit
- 1st January 2008, 07:37
How are you programming the fuses? In the code or the *.inc??

Either way, post the config settings. The 18s are different ...


This is a snippet of my 18F4320.inc




CONFIG OSC = HS

CONFIG LVP = OFF

CONFIG BOR = OFF

CONFIG MCLRE = OFF



; __CONFIG _CONFIG1H, _XT_OSC_1H

; __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H

; __CONFIG _CONFIG4L, _LVP_OFF_4L

dragons_fire
- 27th January 2008, 02:20
ok... i have tried to get this to work lots since last year, adn it still wont do anything. i have pulled apart both boards and checked all the solder joints with my meter, and have gone over and over the design to make sure everything is wired properly. i have replaced the OSC with another one. there is .1uf caps spead out over the board, and i have a 1M ohm resistor from PGM to ground.

i can program code into the chip, and i can read it back, it just wont run. i have an LED connected from D4 to a resistor and then to gnd. all the other ports i have put my meter on and watched for voltage changes.

my code is:

DEFINE OSC 20
pause 500
start:
High porta.0
high porta.1
High porta.2
high porta.3
High porta.4
High porta.5
High porta.6
High porta.7

High portb.0
high portb.1
High portb.2
high portb.3
High portb.4
High portb.5
High portb.6
High portb.7

High portc.0
high portc.1
High portc.2
high portc.3
High portc.4
High portc.5
High portc.6
High portc.7

High portd.0
high portd.1
High portd.2
high portd.3
High portd.4
High portd.5
High portd.6
High portd.7

High porte.0
high porte.1
High porte.2
high porte.3
High porte.4
High porte.5
High porte.6
High porte.7

High portf.0
high portf.1
High portf.2
high portf.3
High portf.4
High portf.5
High portf.6
High portf.7

High portg.0
high portg.1
High portg.2
high portg.3
High portg.4
high portg.5
High portg.6
high portg.7

pause 300

low porta.0
low porta.1
low porta.2
low porta.3
low porta.4
low porta.5
low porta.6
low porta.7

low portb.0
low portb.1
low portb.2
low portb.3
low portb.4
low portb.5
low portb.6
low portb.7

low portc.0
low portc.1
low portc.2
low portc.3
low portc.4
low portc.5
low portc.6
low portc.7

low portd.0
low portd.1
low portd.2
low portd.3
low portd.4
low portd.5
low portd.6
low portd.7

low porte.0
low porte.1
low porte.2
low porte.3
low porte.4
low porte.5
low porte.6
low porte.7

low portf.0
low portf.1
low portf.2
low portf.3
low portf.4
low portf.5
low portf.6
low portf.7

low portg.0
low portg.1
low portg.2
low portg.3
low portg.4
low portg.5
low portg.6
low portg.7
pause 300
goto start
end



and the fuses are set as:

OSC "HS"
System clock "disabled"
power up timer "disabled"
brown out reset "enabled"
brown out voltage "2.0V"
watchdog timer " enabled"
watchdog postscaler "1:128"
ccp2 multiplexed with "RC1"
mclr pin function "reset"
overflow reset "enabled"
LVP "disabled"
boot block "not protected"

im using microcode studio, mpasm and an epic programmer.

skimask
- 27th January 2008, 06:18
[QUOTE=dragons_fire;49764]

DEFINE OSC 20
pause 500
trisa = 0 : trisb = 0 : trisc = 0 : trisd = 0
trise = 0 : trisf = 0 : trisg = 0 : trish = 0
start:
porta = $ff : portb = $ff : portc = $ff
portd = $ff : porte = $ff : portf = $ff
portg = $ff
pause 300
porta = 0 : portb = 0 : portc = 0 : portd = 0
porte = 0 : portf = 0 : portg = 0
pause 300
goto start
end

Easier to read in my mind :) And accomplishes the same thing.
What I like to do when I'm having initial problems is something like this:
counter var word : trisb = 0 : trisd = 0
main:
counter = counter + 1
portb = counter.lowbyte : portd = counter.highbyte
goto main
Something simple like that. At least that way, on each successive pin, I'll see half the frequency of the previous pin.

All of the Vdd/AVdd tied together as well as the Vss/AVss? Multiple power/ground pins ya know... Actually, I know you know...Treadbot...worked...sort of...sorry to hear it didn't work 100% for ya. Looked like fun.
Pull up to +5v on MCLR? Preferably thru a resistor...
Volts on the OSC pins should give about a 1.5v signal, give or take a bit.

Archangel
- 27th January 2008, 09:34
Hello Dragon's_fire.
Here are some config fuses taken from the .INC in the MPASM directory. it might help.


@ __CONFIG _OSC_HS_1H & _LVP_OFF & _WDT_ON_2H & _BOR_OFF_2L & _PWRT_ON_2L & _WRT0_OFF_6L & _CPD_OFF_5H

JS

dragons_fire
- 27th January 2008, 17:02
Skimask, i tried that code you posted, still nothing,... im going up to my otehr computer to see if i can attach a copy of the schematic... i dont think i messed up the hardware, but im kinda scared i did.. when i put my meter across:
OSC1-OSC2, it shows 0V
OSC1-GND, it shows 2.5V
OSC2-GND, it shouws 3.6V

PGM is grounded through a 1Mohm resistor,
all power and ground pins are connected including Avdd and Avss

dragons_fire
- 27th January 2008, 17:19
heres the schematic.. i cleaned it up a little, and all the "empty" pins go to headers for i/o that go to a different board. its a screens hot from eagle cad, so you also wont see the v-reg and capacitors on it either. the voltage regulator is on the top board, and the capacitors were drawn separately, and then spaced around when the board was routed.

http://i163.photobucket.com/albums/t305/dragons_fire_photo/untitled.jpg

skimask
- 28th January 2008, 14:53
OSC1-OSC2, it shows 0V
OSC1-GND, it shows 2.5V
OSC2-GND, it shouws 3.6V


OSC1-2 - should show more than that, but your meter probably won't respond quick enough. Got an AC setting you can try?

OSC1/2 - GND - both sound good to me.

In your schematic, is that a 20Mhz resonator, crystal?
Try changing your config's to use a different type of clock, R/C, external, whatever, see what happens.

dragons_fire
- 28th January 2008, 17:11
i tried checking voltage again. i get around 3mV DC across OSC1-OSC2. on the AC setting it shows nothing but im using a digital meter which might be too slow. i dug out my analog meter, but i have no clue where the leads are for it....

the OSC is a 20.0Mhz ceramic resonator with built in caps. its mountet fairly close to the PIC.

i have tried some of the different clock settings with no luck and i have switched resonators once just in case it was a bad one...

skimask
- 28th January 2008, 17:43
i get around 3mV DC across OSC1-OSC2
That sounds a bit goofy, but I'm not looking at what you're dealing with.

Have you tried a SLOWER oscillator yet, like the R/C, anything, just a signal enough to get it moving?
Heck anything, clicking a push button on/off on the OSC1 pin? :)

And give these config settings a shot:

OSC "HS" - good

System clock "disabled" - good enough, but I like to leave it enabled so I can play with
changing clock speeds

power up timer "disabled" - I'd enable it, gives the clocks more time to spool up and stabilize, causes fewer errors, especially at higher speeds

brown out reset "enabled" - ok, if you're into that sort of thing :)

brown out voltage "2.0V" - good

watchdog timer " enabled" - don't need it, so disable it

the rest are good...in my mind anyways...

mackrackit
- 28th January 2008, 18:25
Are you setting the fuses in the code or in the *.inc?

Either way, Post what you have, I know what you say you have but how? The 18s sometimes are a bit "picky" this way. At least with different versions of PBP.

dragons_fire
- 28th January 2008, 18:43
there in the inc file.. i was just reading them from the epic programmer. it has a list of what everything is set as, and i can change it there too..

i made it all with SMT stuff, and its pretty tiny (yes ive checked for crossed traces) so i have no other OSC's to connect to it. and i think its too small to wire up jumpers too...

dragons_fire
- 28th January 2008, 18:52
heres my INC file..


NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F6680, r = dec, w = -311,w = -230, f = inhx32
INCLUDE "P18F6680.INC" ; MPASM Header
__CONFIG _CONFIG1H, _OSC_HS_1H
__CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8

mackrackit
- 28th January 2008, 19:06
See post 14 of this thread. One of the PBP versions fixed this but I am not sure which one, Been doing it this way since 2.43. Still works for me.

dragons_fire
- 28th January 2008, 19:23
so i want it like this???


CONFIG OSC = HS

CONFIG LVP = OFF

CONFIG BOR = OFF

CONFIG MCLRE = ON


and not like this??

__CONFIG _CONFIG1H, _OSC_HS_1H
__CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L

i tired changing it, and i switched to a 10Mhz resonator that i know works, and im still having this problem.. do you think it could be the chip? or if there was a problem with it, would i still be able to program it and read the code back??

thanks for the help guys

skimask
- 28th January 2008, 19:32
i tired changing it, and i switched to a 10Mhz resonator that i know works, and im still having this problem.. do you think it could be the chip? or if there was a problem with it, would i still be able to program it and read the code back??

I'd have to say a resounding yes.
I don't know how many transistors any given PIC has in it, but think about it for a second.
Every I/O pin except Vdd/Vss/MCLR/OSC/PGD/PGC/PGM could be blown out, the program is running but you can't see it.
The oscillator section itself could be fried. This PIC apparently doesn't have a backup internal oscillator of any sort, so that options out.
Could be any number of a thousand things, so many 'sections' packed in there, and ICSP only uses a few of them.

However, I'll also say that I've only completely fried one PIC in 10-12 years of messing with them. One pin here, one pin there, input driver, output driver (usually the case)....yes, one here and there, but not a whole chip.

dragons_fire
- 28th January 2008, 19:43
ok... i havent done anything "bad" to this one either... and ive wrecked a few so far.. mostly inserting into sockets backwards!!! and the last one i did, was when i first started SMT stuff, i soldered a 44-tqfp 16f877a with the writing up, so pin 12 (i think) was where pin 1 shoulda been.. i didnt look at the little dot in the corner.... i kept trying to program it, and for some reason it wouldnt program!!!

ill take a picture of the board in a few minutes... dont make fun of the solder, im doing it all by hand with a $20 iron.. i have also soldered parts multiple times trying different things.. which reminds me, when i can afford it, i will probably buy some 18f's in DIPs so i can breadboard it and play around... i just cant seem to get them to work and im not sure why...

skimask
- 28th January 2008, 19:52
ok... i havent done anything "bad" to this one either... and ive wrecked a few so far.. mostly inserting into sockets backwards!!! and the last one i did, was when i first started SMT stuff, i soldered a 44-tqfp 16f877a with the writing up, so pin 12 (i think) was where pin 1 shoulda been.. i didnt look at the little dot in the corner.... i kept trying to program it, and for some reason it wouldnt program!!!
Isn't nothing anybody else hasn't done :D
I've done it too, but I have yet to smoke one.


dont make fun of the solder, im doing it all by hand with a $20 iron..
Have you seen my webpage with the picture of the old mp3 player on it?
That'll get you laughing...
Do yourself a favor and get your hands on a good soldering station...nothing like it, some flux, alcohol dispensor, acid brushes, all that good stuff.
I went thru a 7 week micro-mini- circuit card repair class last year (spent about 6 1/2 of those 7 weeks with my head buried in a microscope). I got back and bought a load of good tools for soldering. Made that part of it LOADS easier, to include soldering and desoldering 80 pin TQFP's on and off PCBs.

dragons_fire
- 28th January 2008, 20:00
i looked at you website a while ago, i dont remember the cd player, but im gonna have to go back for another look.

looking at my board on the picture, it actually doesnt look as bad as i thought... (except where the OSC is.. )

http://i163.photobucket.com/albums/t305/dragons_fire_photo/IMG_0507.jpg

the 5-pin 90* header is the ICSP
the 12-pin 90* headers on each end go to sensors and servos and everything else i can imagine
the 5-pin headers go to the top board that has the power circuit on it. it also has a basic LCD display and the power headers to go to the servos/sensors

i do use flux, really small solder and flux remover...

mackrackit
- 28th January 2008, 23:50
so i want it like this???


CONFIG OSC = HS

CONFIG LVP = OFF

CONFIG BOR = OFF

CONFIG MCLRE = ON


and not like this??

__CONFIG _CONFIG1H, _OSC_HS_1H
__CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L

i tired changing it, and i switched to a 10Mhz resonator that i know works, and im still having this problem.. do you think it could be the chip? or if there was a problem with it, would i still be able to program it and read the code back??

thanks for the help guys

See this
http://www.picbasic.co.uk/forum/showpost.php?p=13087&postcount=6
But I guess it was fixed in 2.47?

Get the bread board stuff or a ZIF socket for developing. Will save a few headaches, may add a few too, but they will be different:)

dragons_fire
- 29th January 2008, 00:12
ok.... i think i saw that before, but it didnt make any sense... i think i get it now...

Darrel Taylor
- 29th January 2008, 00:37
Somethings confusing me here.

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2301&stc=1&d=1201563308" />

The schematic shows GND on pin 1 of the ICSP connector.
But Pin2 (+5V) goes to the center pin of the resonator.

Is the schematic wrong? Or am I looking at the pins wrong?
<br>

dragons_fire
- 29th January 2008, 00:37
just going through the datasheet for the 6680 again, it says i may need a resistor between OSC2 and the resonator if its an AT strip cut crystal... how do i know if i need that resistor???

dragons_fire
- 29th January 2008, 00:59
Darrel, i just looked at it, and i thought you had found it.. i stuck my meter on it and it says its correct. so i went back to the schematic and looked. its the otehr 5-pin header on the schematic that is for ISCP, the one you highlighted goes to the other board, and comes from the power supply. its the straight header on the board.

i wish you were right... then i would actually know what i did wrong...

Darrel Taylor
- 29th January 2008, 01:17
Yup, should have, should have seen that. :o

Can you show the board layout's?
It's hard to follow past the via's.
<br>

dragons_fire
- 29th January 2008, 02:25
ill see what i can do about the layout.. ive looked over it and it seems ok, but what do i know!!! i used eaglecads autoroute function so everything "should" be connected properly...

dragons_fire
- 29th January 2008, 02:59
http://i163.photobucket.com/albums/t305/dragons_fire_photo/bottom.jpg

theres the image of the board, and i will attach the eagle file here too.

i labelled all the "important" pins. the rest go to I/Os.... and MCLR2 resistor, is a 1Mohm resistor, and its for PGM. i just didnt relabel it when i put it in there... and there was an issue with the gnd side of the caps, so i ran a jumper wire from there to the ground pin..

Darrel Taylor
- 29th January 2008, 06:03
Probably another wrong one, but I can't tell from the picture.

Looking at some of the holes, they don't seem to be plated thru.
It could be reflections from the other side or something. :confused:

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2304&stc=1&d=1201582570" />

Where it would matter the most (if true) is on the +5V pin on that connector I should have been looking at the first time.
It doesn't have a good solder joint on the top layer, which is the side the trace connects to.

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2305&stc=1&d=1201582834" />

If the thru-hole plating is intact, it probably won't matter.
<br>

skimask
- 29th January 2008, 14:57
Looking at some of the holes, they don't seem to be plated thru.
It could be reflections from the other side or something. :confused:


If I remember right, from the other Treadbot thread, these are homemade PCB's correct? Probably not plated thru holes unless he's got some fancy-shmancy equipment.
But that's easy enough to work around.
I'm rooting for that to be the fix..........Big bucks....no whammy's......STOP!

dragons_fire
- 29th January 2008, 15:25
the treadbot board was homemade... this ones not... i can get these made at Alberta Printed Circuits for less than it costs me to make them.. and these ones have thru-plating and better traces..

skimask
- 29th January 2008, 19:19
the treadbot board was homemade... this ones not... i can get these made at Alberta Printed Circuits for less than it costs me to make them.. and these ones have thru-plating and better traces..

I lost again...
I forget...aren't you 'just up the street' from me? Calgary or something?

Darrel Taylor
- 29th January 2008, 20:12
I lost again...

Me too. :(
<br>

dragons_fire
- 29th January 2008, 20:24
yeah... . i just dont know about this board...

im in Calgary, and its -42C with the windchill and im workin outside...

Alberta Printed Circuits has a prototyping service that is two boards, double sided with thru-plating... these two boards (the top and bottom were joined together and then i cut it after) were about 3.2" X 2.5", and cost around $36 total... so each board was $13 and there made next day.... its almost not worth it for me to make them....

so i have another board the same as this one, so i might pick up another PIC and try it all again just in case i shorted something or the PIC is bad...

I have no affiliation with apcircuits, but they do good work and they have helped me through design problems so if youre looking for somewhere to make some boards, take a look at them...

eagle cad takes the schematic (which is easy to make and troubleshoot) and makes it into a board, then i email that to apc and then solder it together... there isnt a lot i can do wrong if the design is right, and the soldering is right...

skimask
- 29th January 2008, 20:33
yeah...i just dont know about this board...
Desoldering a TQFP without a desoldering tool...heat the pins up, bend them up with something. If it's not the chip, you can probably resurrect the chip by laying it flat on a suitable spacer and flattening the pins back down with a toothpick...works for me anyways.


im in Calgary, and its -42C with the windchill and im workin outside...
Yep, in Minot. You guys sent us this Alberta Clipper! And it rocks!!! Radio is saying -15F with -52F windchill (whipping up out there about 25-45MPH).


Alberta Printed Circuits has a prototyping service that is two boards....
Personally, I use www.pcbexpress.com, but that's only because I've got an older version of Protel 2.7.5 and they support it. If I only had Gerber files to work with, I'd probably go with APCircuits.


so i might pick up another PIC and try it all again just in case i shorted something or the PIC is bad...
Get one with an internal OSC option, like the 18F6723 or something...unless you need the CAN option. Incidentally, it's really easy to overlay an 80pin TQFP over the top of a 64pin TQFP and give you both options. When I made those 80pin TQFP -> dual 40 pin/IDC adapters awhile back, I did exactly that...made the center of the PCB able to take either an 18F6720 (64 pin) or an 18F8720 (80 pin)...same layout, just added 2 pins at each end on each side, spacing still the same, etc.etc.etc.

dragons_fire
- 29th January 2008, 20:53
the only reason i went with this PIC, is cause of microchips little PIC selector charts. it had the right number of I/Os, and a lot of memory... i think the next time, i will go with an 80-tqfp and something that will support external program memory.. then i should be able to start with the basic flashing led on internal memory, and slowly move up to more advanced...

Darrel Taylor
- 29th January 2008, 21:09
Well I've only got one more possibility.

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2314&stc=1&d=1201637027" />

Some of the via's under the PIC are Really close to the pins.
And there's no way to tell from the picture.
It would take an ohm meter to know if they're shorted or not.

But, since you're going to try the second PCB ...

If you send me the first one, I WILL find why it's not working.
<br>

dragons_fire
- 29th January 2008, 21:15
well, if i get the second one going, i may send it to you if ya want... i really only need one, but its still easier and cheaper to get 2 made...

i have never tried microchips "free" trials before. i may have to do that and try a few of the different PICs.

i can program it, and it draws very little current, so i dont think the power pins are shorted. and if the I/O pins were shorted, i should still have voltage on my pin since im making every pin high.

the only problems i could see from shorting, is if i shorted an i/o to ground, and its pulled too much current. or if mclr is connected to ground or something else it shouldnt be...

Darrel Taylor
- 29th January 2008, 21:28
well, if i get the second one going, i may send it to you if ya want... i really only need one, but its still easier and cheaper to get 2 made...
I'll send it back when I'm done. And you might want to know what's wrong before you do the second one.


i can program it, and it draws very little current, so i dont think the power pins are shorted. and if the I/O pins were shorted, i should still have voltage on my pin since im making every pin high.

the only problems i could see from shorting, is if i shorted an i/o to ground, and its pulled too much current. or if mclr is connected to ground or something else it shouldnt be...
On the right side of the last picture I posted, there are 2 lines.
The bottom one is pointing to a via that is between GND and one of the oscillator pins.
If that ones shorted, it probably won't draw much current, but the oscillator won't work.
And if there's no OSC, then shorts on the other pins won't draw current either, cause they never get turned on.

But again, no way to know without an ohmmeter.
<br>

dragons_fire
- 29th January 2008, 21:59
i checked both osc pins to ground with my meter when i soldered the osc... since it was so small, i checked it to make sure i didnt have any solder bridges on the OSC.

you guys are great though... if it wasnt for your suggestions, i would have given up on it long ago...

Darrel Taylor
- 29th January 2008, 22:11
Ok, well it's up to you.

It's just that I've been looking at it long enough that I'd really like to know what the problem is.

I have a hot air re-work station, oscilliscope DVM's etc.
<br>

skimask
- 29th January 2008, 22:19
Ok, well it's up to you.
It's just that I've been looking at it long enough that I'd really like to know what the problem is.
I have a hot air re-work station, oscilliscope DVM's etc.
<br>

Tin-whisker anyone?

dragons_fire
- 29th January 2008, 22:57
i have an oscilliscope (sorta)!!! i dont know how to use it or if it will even work... but it was fun to play around with... i want to know what the problem is so i can move on with this project...

http://i163.photobucket.com/albums/t305/dragons_fire_photo/IMG_0371.jpg thats my oscilliscope in the bottom right corner... its an RCA and meant for back in the tube days....



and if you look close on the shelf, you can see treadbot sitting there!!!

dragons_fire
- 30th January 2008, 06:07
i have juast gone over the board quickly, i will do it again tomorrow when i have more time, but i get:

0 ohms between all +5v traces
0 ohms between all gnd traces
30M ohms between all I/O pins and +5V
1M ohm between power and ground
4-12M ohms between all I/O pins and gnd
17M ohm between OSC2 and gnd
12M ohm between OSC1 and gnd
29M ohms between OSC2 and +5v
23M ohms between OSC1 and +5v

Darrel Taylor
- 30th January 2008, 23:39
I'm jealous!

I want a mill and a lathe and a drill press and a belt sander and a jig saw and a bench grinder and a ... better scope. :D
<br>

skimask
- 31st January 2008, 00:29
I'm jealous!
I want a mill and a lathe and a drill press and a belt sander and a jig saw and a bench grinder and a ... better scope. :D
<br>

Don't forget the Get-Away car!

Darrel Taylor
- 31st January 2008, 01:07
Don't forget the Get-Away car!
Yeah, OK.
I want one of those too. :)

<a href="http://s163.photobucket.com/albums/t305/dragons_fire_photo/?action=view&current=IMG_1917.jpg" target="_blank"><img src="http://i163.photobucket.com/albums/t305/dragons_fire_photo/IMG_1917.jpg" border="0" alt="Photobucket"></a>

dragons_fire
- 31st January 2008, 01:11
i take it you looked at some of the other pics on my photobucket!!! what can i say... i can NEVER have too many tools!!!

skimask
- 31st January 2008, 01:24
Yeah, OK.
I want one of those too. :)


Which PIC runs that? :D

It's probably just a matter of time...

dragons_fire
- 31st January 2008, 01:42
there isnt any PICs in it... but i took apart a sunroof motor yesterday that im using for another robot, and it has a 16F72 in it...

dragons_fire
- 31st January 2008, 03:52
im still working on this board, i have checked the design twice more, and still dont see anything wrong with it.. when i connect the battery, i get just under 5V (and the PIC is good down too 2v). if i go across any I/O pin and gnd i get 0V and i get the same going from I/O to 5V.....

if the pins were low, i should see voltage between I/O and 5V
and if it was high i should see voltage between I/O and gnd....right??

while i have the programmer hooked up, it goes down to about 2.5V on mclr to gnd, and then when i program, it goes up to 13V. without the programmer, its at 5V

i have tried 3 different OSCs at 2 different speeds, and thats not helping, i know the power supply is good, so it has to be the PIC or the board..

Archangel
- 31st January 2008, 05:52
and the fuses are set as:

OSC "HS"
<font color=red>System clock "disabled"
</font color>power up timer "disabled"
brown out reset "enabled"
brown out voltage "2.0V"
watchdog timer " enabled"
watchdog postscaler "1:128"
ccp2 multiplexed with "RC1"
mclr pin function "reset"
overflow reset "enabled"
LVP "disabled"
boot block "not protected"

i'm using microcode studio, mpasm and an epic programmer.
What does it mean system clock disabled? Does this mean no oscillator?

dragons_fire
- 31st January 2008, 17:08
What does it mean system clock disabled? Does this mean no oscillator?

im not sure... i have tried it on both enabled and disabled. those were taken from the config settings of my programmer.

skimask
- 31st January 2008, 17:19
im not sure... i have tried it on both enabled and disabled. those were taken from the config settings of my programmer.

System clock is actually OSCSEN.
While a program is running, you can switch the clock source from the main clock source (crystal, R/C, whatever) over to the Timer1 clock source, and back again.

dragons_fire
- 31st January 2008, 17:42
GOOD TO KNOW... i learn so much from all of you on here.... i know these PICs say they are static sensitive, but how bad is it?? should i be wearing a strap every time i think about looking at it?? or do i really need to worry about it. i know with the 16f devices i have used, they say they are static sensitive, but i have never worried about it and never had any problems...

skimask
- 31st January 2008, 19:58
GOOD TO KNOW... i learn so much from all of you on here.... i know these PICs say they are static sensitive, but how bad is it?? should i be wearing a strap every time i think about looking at it?? or do i really need to worry about it. i know with the 16f devices i have used, they say they are static sensitive, but i have never worried about it and never had any problems...

I haven't COMPLETELY blown a PIC up with static...YET! I know how dry it gets where you're at (remember, I'm just a bit south-east of you). My 'shop' is in the basement, usually about 20% humidity in the winter, carpet on the floor, and so on and so on.
I think, that is, THINK, the worst I've done to a PIC is blow out an output driver or two on a few PICs...and I'm not even 100% sure it was static that did it. Probably from putting them in the socket backwards, etc.
However, I've heard that the 18F's are quite a bit more static sensitive than the 16F's were, probably due to the smaller gate size on the die...not sure...don't care. As long as I don't smoke anymore, I'm all good...

dragons_fire
- 31st January 2008, 20:29
ok, i was just kind of curious... i get them from Digi-key and they come in a vacuum sealed static bag with one of those little dessicant bags in it and a humidity tester... the 16f ones, come in a little static bag thats just folded over on its self so it doesnt fall out!!

dragons_fire
- 1st February 2008, 18:16
i de-soldered the pic from the board, everything looks good under there... no solder bridges or shorts of any kind.. everything looks good... i ordered another PIC so it should be here on monday and i will try that...

i wish there was a pin compatible 16f PIC that i could throw in there and see if i could get it to work... then i would know the board is ok...

dragons_fire
- 4th February 2008, 04:56
DEFINE OSC 20
pause 500
trisa = 0 : trisb = 0 : trisc = 0 : trisd = 0
trise = 0 : trisf = 0 : trisg = 0 : trish = 0
start:
porta = $ff : portb = $ff : portc = $ff
portd = $ff : porte = $ff : portf = $ff
portg = $ff
pause 300
porta = 0 : portb = 0 : portc = 0 : portd = 0
porte = 0 : portf = 0 : portg = 0
pause 300
goto start
end
[/code]



just wondering if doing it this way decreases code size too, or if it just makes for less typing??? im working on writing some code for this project (if i can ever get the board to work) and i know it would make the code smaller to look at if i did it as above, but i think it would be harder to write since i have labeled all my ports for what they do, so when i write it, i use those "labels"....

Archangel
- 4th February 2008, 07:46
just wondering if doing it this way decreases code size too, or if it just makes for less typing??? im working on writing some code for this project (if i can ever get the board to work) and i know it would make the code smaller to look at if i did it as above, but i think it would be harder to write since i have labeled all my ports for what they do, so when i write it, i use those "labels"....
The hex file comes out the same, this works for very organised people, who know the subject material very well, I suggest you do it the other way with loads of comments so a year from now, when your are even better than you are now . . you can make sense of what you did as you rewrite your code . . . and you will. ;)
JS

skimask
- 4th February 2008, 14:52
just wondering if doing it this way decreases code size too, or if it just makes for less typing??? im working on writing some code for this project (if i can ever get the board to work) and i know it would make the code smaller to look at if i did it as above, but i think it would be harder to write since i have labeled all my ports for what they do, so when i write it, i use those "labels"....

Nope, it's just a 'me-ism' thing.
I like to get as much code on a screen as I can. I hate scrolling up and down and if I've got a longer routine, I can bunch it all up in one page. It's my STYLE, if you can call it that.
Some people hate it, I mean really HATE it...too bad, so sad, don't care. If a guy has half a brain, they'd know how to use the 'replace' shortcut in WORD to put a single command on each line, and if not that, they'd at least know how to split it up. For instance, my latest project is about 1700 lines of the bunched up code, fills an 18F4620...no extra line breaks, no extra spaces, no nothing, etc. If I was to spread that out, make it "right", I estimate it would take up about 8500 lines. Forget that noise. Most of the time, my 2nd monitor is turned 90 right and Windows adjusted accordingly, like it's in 'Portrait' mode instead of the normal landscape...oh and it's 1600x1200, so that really packs it in there.
What's a guy expect for FREE help?

But like Joe said, it's all personal preference. Get your own method, stick with it, it's all good...

Pic_User
- 4th February 2008, 15:04
skimask’s method is perfect for his style of programming.

as Joe said: “people, who know the subject material very well”

But if anyone wants the forum to help with their code (skimask never needs help), I wouldn’t advise posting your “problem code” in this style. :eek:

-Adam-

skimask
- 4th February 2008, 15:51
(skimask never needs help)
-Adam-

'taint so! :D
I think the main difference is in the use of the 'Search' function here and at Google, or wherever...I'd be willing to bet I spend more time researching HOW to do stuff vs. actually doing it. :)
And this weekend, I could sure use some help doing some sanding, and in fact, I might even need help cleaning out all of those left over full cans of preferred beverages from the 'fridge in the basement...

dragons_fire
- 4th February 2008, 17:44
And this weekend, I could sure use some help doing some sanding

i would come give you a hand, but "unfortunately" i dont have a passport!!! and i have to wait for Puralator to deliver more parts!!!

skimask
- 4th February 2008, 18:13
i would come give you a hand, but "unfortunately" i dont have a passport!!! and i have to wait for Puralator to deliver more parts!!!

Passports? I thought all we needed was photo Gov't ID. I'd better do some checking. I've got a trip planned for this summer...here, thru the Black Hills/Rapid City, over to Yellowstone/Grand Tetons, up to Glacier (both U.S. and Canada versions), thru Banff and Jasper, up to Denali in Alaska, and back, sidestepping thru Yellowknife and back down.

dragons_fire
- 4th February 2008, 18:59
sounds like a good trip... i think to fly we need a passport now, but to drive you just need two pieces of government id..

so i noticed a while ago that i had shorted one OSC pin to 5v, would that have blown the OSC part of the chip???

skimask
- 4th February 2008, 19:10
sounds like a good trip... i think to fly we need a passport now, but to drive you just need two pieces of government id..
It's all a bit confusing... To get into Canada, I need one thing, to get back into the U.S., I need other things. Gotta do more looking.


so i noticed a while ago that i had shorted one OSC pin to 5v, would that have blown the OSC part of the chip???
I wouldn't think so, but...you know how far that goes...
In external modes with crystals, the crystal/resonator is driving a differential amp inside the PIC (variable gain set by the CONFIG registers). I suppose if you had OSC1 driven to +5v and OSC2 driven to ground, you might blow it out (maximum differential = maximum output). Not really sure about that theory though, and surely not about to try it out. :D

dragons_fire
- 4th February 2008, 19:46
my stuff just got here a couple minutes ago, and so i soldered a new PIC to the board, and it WORKED!!!!

thanks to all the guys that had suggestions about why it didnt work, but it seems good now.. i just need to solder the top board back on (i was using jumper wires while testing)....

Archangel
- 4th February 2008, 21:30
i would come give you a hand, but "unfortunately" i dont have a passport!!! and i have to wait for Puralator to deliver more parts!!!
That only matters if you come from the north! ;)

mackrackit
- 4th February 2008, 21:54
That only matters if you come from the north! ;)
Sad but true:mad:

dragons_fire
- 4th February 2008, 22:28
That only matters if you come from the north! ;)

Really?? so when we are told that the USA is changing it to the same regulations canada has when you guys try to come up here, its not really true???


so i got the board working, and it all seems ok, except for my LCD. the LCd im using is a 24-pin DIP. one pin is common, and the rest are linked directly to one segment. i can get it to work somewhat, but sometimes certain segments dont dissapear when they are supposed to, and others dont always appear when they should.. i think maybe its cause the traces are so close together, and i cant clean all the flux off...

mackrackit
- 4th February 2008, 22:38
Really?? so when we are told that the USA is changing it to the same regulations canada has when you guys try to come up here, its not really true???

I took it that Joe meant coming into the US from the south. Regulations do not seem to matter here for that. Illegal boarder crossing seems to be encouraged.

skimask
- 5th February 2008, 15:05
Really?? so when we are told that the USA is changing it to the same regulations canada has when you guys try to come up here, its not really true???
I got a friend who works the border just north of Antler, ND. (southwest of Regina by quite a bit). I'm going to ask him this weekend.


so i got the board working, and it all seems ok, except for my LCD. the LCd im using is a 24-pin DIP. one pin is common, and the rest are linked directly to one segment. i can get it to work somewhat, but sometimes certain segments dont dissapear when they are supposed to, and others dont always appear when they should.. i think maybe its cause the traces are so close together, and i cant clean all the flux off...

Flux - rubbing alcohol (standard grocery store stuff) and cotten swabs and/or those acid brushes (or just a small stiff paint brush) work wonders. Overnight soaking doesn't help, re-heating the flux with an iron doesn't work. Just good ol' elbow grease.

What kind of LCD do you have that has 24 pins? Is this one of those 7-segment types?
You should look into the whole Nokia-knock-off LCDs (check www.sparkfun.com). Easy to control, 6 lines from the PIC, 130x130 pixels, and in color. I'm having a blast with mine.

dragons_fire
- 5th February 2008, 20:02
Flux - rubbing alcohol (standard grocery store stuff) and cotten swabs and/or those acid brushes (or just a small stiff paint brush) work wonders. Overnight soaking doesn't help, re-heating the flux with an iron doesn't work. Just good ol' elbow grease.

What kind of LCD do you have that has 24 pins? Is this one of those 7-segment types?
You should look into the whole Nokia-knock-off LCDs (check www.sparkfun.com). Easy to control, 6 lines from the PIC, 130x130 pixels, and in color. I'm having a blast with mine.

the LCD im using is the seven segment type. it had 3 digits and two decimal points. there is 24-pins (one common, 3digits*7segments is 21 pins, and then the two decimal points. im using a 4x20 serial LCD for debugging and showing lots of info, but i would like to have this on top just to show small amounts of info. these things were pretty cheap, so i thought i would try it. and the datasheet shows the pinout but thats about it. they dont have current of voltage ratings, so i tried it on the breadboard and it seems to work at 5V and my meter doesnt show any current. it also seems as though it will "light" up all the way down to .5V (maybe lower but thats as far as i tried). so im thinking i might be getting inductance or a little leakage off of the flux on the traces that are beside each other.

i was thinking about the nokia lcd, and i would like it, but i wanted to keep this really small and simple. i havent looked at what it takes for code space either.. is it the same as a parallel LCD?? my little 3 digit one takes lots just because i need to tell it to turn on different ports.

im working on a flight data recorder for my rc airplanes, and i know there are some out there that i could buy for cheaper than i can make (i already have one too), but i would like to make my own. i will try to post a pic when i get home tonight..

skimask
- 5th February 2008, 20:09
these things were pretty cheap, so i thought i would try it.
Keep your eyes on eBay. You can 8x1 LCDs, parallel types compatible with the LCDOUT statement for dirt cheap. I've got about a dozen extra's laying around just for that purpose.


so im thinking i might be getting inductance or a little leakage off of the flux on the traces that are beside each other.
I'd doubt it, but anything is possible. More likely you're getting a leak from a 'hidden ground' thru some other pins or thru a couple of extra diodes somewhere.


i was thinking about the nokia lcd, and i would like it, but i wanted to keep this really small and simple. i havent looked at what it takes for code space either.. is it the same as a parallel LCD?? my little 3 digit one takes lots just because i need to tell it to turn on different ports.
Not even close to a parallel LCD...
The font takes up about 500 bytes of EEPROM, the code itself and subroutines to run the thing, I'd guess about 8K at the most, including the graphics subroutines.
But think about it...once you get the routines written and they work, it's just a matter of 'INCLUDE'-ing them in your latest project.

dragons_fire
- 5th February 2008, 20:27
i made the code for this LCD as a seperate file, and just "include"d it into the main program. its actually the first time i have used the include command. now that i think about it, i should make sure i labelled all my ports properly for the display.

i know there is cheap parrallel displays around that are 2x8 or 2x10, so i might think about one of them...

ive been thinking about redesigning it and including some other stuff that i would like too. there is going to be a parallax GPS in this project, and i need to do some calculations for directions, so i need to use arctan. i think it might be easier to include a math coprocessor to do the calculations... i would also like to change the voltage regulatorto something that can supply more current, since im using the same supply for multiple things.

i will probably get this thing going and use it to test all the other "bits" i want to add, then after i have things working, i will make a new design and include more stuff.

skimask
- 5th February 2008, 20:34
i made the code for this LCD as a seperate file, and just "include"d it into the main program.
That's the way to do it...handy, quick, not so easy to transport between 2 people and have the other guy understand at first glance...but still good...


i know there is cheap parrallel displays around that are 2x8 or 2x10, so i might think about one of them...
I tell ya what...I love my Nokia displays. 12 (actually 16, but takes more code) bit color, 132x132 (130x130 usable) resolution, 21x15 text (with a 5x7 font), made subroutines for all sorts of graphics, 6 pins (power, ground, reset, select, data, clock). I've got a 'saved search' on eBay all set aside just for the Nokia 3310 compatible displays and I snag one up every time I see a cheap one.
The only 'problem' with it is when you go to do a full screen refresh. Even with an 18F4620 using the hardware SPI, a full screen refresh takes awhile. I figure I can only get about 2-3 frames/second. But that's redrawing the ENTIRE screen, one pixel at a time.

dragons_fire
- 6th February 2008, 00:41
here is a picture of the top of the board. its a little fuzzy compared to my other pics, but i was too lazy to go downstairs to get more batteries for my flash.

http://i163.photobucket.com/albums/t305/dragons_fire_photo/IMG_0508.jpg

i should mention that the solder joints are better than they look, and the flux has been cleaned of a little better since that pic was taken.

the power input is on the bottom of this board, then it goes through the switch and to the buck regulator underneath the LCD, and then the inductor is the black thing on the right. i ordered the wrong ones, when i built this, so i do have smaller, lighter ones now, i jsut havent put them on.

the segments on the lcd that im having problems with, will work sometimes but not others, so i am going to stick the meter on and see what it says.

skimask
- 6th February 2008, 02:28
the segments on the lcd that im having problems with, will work sometimes but not others, so i am going to stick the meter on and see what it says.

You said you were aiming to build something for an R/C plane?
I'm wondering how good (bad?) those LCD segments will look at certain angles with direct sunlight behind/beside/in-front-of them...

dragons_fire
- 6th February 2008, 04:24
it seems to appear like a digital watch when "lit" up.. im assuming it should look about the same in light... i don't really know though... if it doesn't work, i will try something else... thats whats good about doing it as a hobby!!! no deadlines and as long as its cheap, i can try different things until i find something i like.. i cant remember now, but i think i got these displays for around $1 each, and then i got a couple that are 2.5 digits ( 1.8.8) and some LED backlights for them for a couple bucks a set too.

i will try to post a video of what the display is doing.. then maybe someone will have an idea of what is actually happening....

dragons_fire
- 6th February 2008, 07:06
forget the video, i got it working... i had a couple of the ports backwards.. it works good and heres a pic of the lcd with direct camera flash.. it should show up ok in hte sun

http://i163.photobucket.com/albums/t305/dragons_fire_photo/IMG_0512.jpg