Searching \ for '[PIC]: trouble getting started' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/begin.htm?key=pic
Search entire site for: 'trouble getting started'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: trouble getting started'
2001\08\31@231329 by Michael Maiorana

flavicon
face
Thanks for reading this. I'm trying to get started playing with PIC's and
I'm having some difficulty. I have been unable to find any help in the FAQ
or the archives (archive searches are failing).
Here is what I did.
I built the parallel port flash pic programmer from
www.rotgradpsi.de/mc/picproge.html#UnterstuetztePICs
I am trying to program a 16f870. I assembled my code using the mpasm. The
programmer properly identifies the PIC and says it succesfully programmed
it. When I put the pic in its circuit, the oscillator does not run (and
obviously it doesn't work).
The code is simple, I stole it from the archives and tweeked it for the
16f870. The code is at the end of this message.
The circuit is equally simple. RC4 has a 1k resistor, to an LED, to ground.
There is a 4MHz crystal across the "osc" pins, with 22pf caps to ground on
each side. Ground to pins 8 and 19, and 5 volts to pin 20. When I apply
power I get no flashing and an oscilloscope on the crystal shows it is not
oscillating.
As a side note, I tried to add the following line to my code to insure that
the config register was correctly configured for a crystal
__CONFIG _HS_OSC
The code assembles, but the programmer freaks out with programming errors. I
looked at the hex file and it looks wrong. Here is the second to last line,
which is the only difference between the code that programmed correctly and
the new code with the config register specified.
:02400E00FE3F73
I thought the first two bytes were the number of bytes to program on this
line, the next two were the address, and the last byte was the checksum.
This is supposed to be writing 3FFE hex to address 2007 (or 400E in the hex
file). Notice that the length is only one byte long, and the address does
not have the bytes reversed, and that there is an extra 00 in the middle.
Can anyone make sense of this?

If you can think of some thing to try I'd appreciate the help.
Best Regards,
Mike M.
Palm Harbor, FL

;
       Title "LED flasher."
;
       list P = 16F870
;
       include "P16f870.inc"  ; use definition file for 16F870
;
; --------------------
; USER RAM DEFINITIONS
; --------------------
;
       CBLOCK 0x20   ; RAM starts at address 20h
NaHi
NaLo
NbHi
NbLo
       ENDC
;
       org 0x0000      ; start address = 0000h

; INITIALISE PORTS
; binary used to see individual pin level

       movlw b'00000000'       ; all port pins = low
       movwf PORTA
       movlw b'00000000'
       movwf PORTB
       movlw b'00000000'
       movwf PORTC

       bsf STATUS,RP0  ; set RAM Page 1 for TRIS registers

; INITIALISE PORTS
; binary used to see individual pin IO status

       movlw b'00000000'       ; all IO pins = outputs
       movwf TRISA
       movlw b'00000000'
       movwf TRISB
       movlw b'00000000'
       movwf TRISC

       movlw b'00000110'       ; all analog pins = digital
       movwf ADCON1

       bcf STATUS,RP0  ; back to RAM page 0

; LED FLASH LOOP

Loop    bsf PORTC,4     ; RC4 = high = led on
       call Delay

       bcf PORTC,4     ; RC4 = low = led off
       call Delay
       goto Loop

; 1/2 SEC DELAY SUBROUTINE WITH 4MHz CLOCK

Delay   movlw 01h
       movwf NbHi
       movlw 03h
       movwf NbLo
       movlw 8Ah
       movwf NaHi
       movlw 5Bh
       movwf NaLo

DeLoop0 decfsz NaLo,F
       goto DeLoop0
       decfsz NaHi,F
       goto DeLoop0
       decfsz NbLo,F
       goto DeLoop0
       decfsz NbHi,F
       goto DeLoop0
       ;
       return

       end

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\08\31@233233 by Michael Maiorana

flavicon
face
Just a quick update, I pulled the crystal and installed an RC oscillator.
Now the PIC works. So it must have to do with the config register and/or the
programmer. Any help?
Thanks
Mike M.
Palm Harbor, FL

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\08\31@235944 by Andrew E. Kalman

flavicon
face
>Just a quick update, I pulled the crystal and installed an RC oscillator.
>Now the PIC works. So it must have to do with the config register and/or the
>programmer. Any help?

Assuming you're using PICSTART Plus or MPLAB-ICD, you'll find a
pull-down that selects between RC and other choices. That needs to be
correct when you program your device.

Most C compilers have a special configuration directive like

__CONFIG( RC )

that, when compiled, results in the hex code (*.hex) containing the
settings required for the configuration word.  MPASM has a similar
directive.

BTW, the config word is just another programmable address, but it's
way up high in memory. When you set it manually (when programming) or
automatically (via CONFIG directives in C or assembly) , you're
simply programming that address with device-specific configuration
settings.

When you assemble or compile an application, the manual settings in
PICSTART Plus or MPLAB-ICD reflect the value of the config bits, i.e.
they "read" the hex file. So if you do nothing, the oscillator bits
will remain at 1 (unprogrammed PIC).  On the 16C77 (and many others),
1's in FOSC1:FOSC0 mean "RC oscillator is selected." So that's why it
works with RC and not HS or XT.

Regards,
--

 ______________________________________
  Andrew E. Kalman, Ph.D.   spam_OUTaekTakeThisOuTspampumpkininc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics



'[PIC]: trouble getting started'
2001\09\01@092736 by Olin Lathrop
face picon face
> When I apply
> power I get no flashing and an oscilloscope on the crystal shows it is not
> oscillating.

A "bare" oscilliscope probe can kill the oscillations.  A X10 probe usually
works.

> __CONFIG _HS_OSC

At 4 MHz, you should probably be using the XT oscillator mode.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, .....olinKILLspamspam@spam@embedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\09\01@110616 by Michael Maiorana

flavicon
face
Andrew,
Thanks for the help. Yes, I see that it is necessary for me to program the
config register in order to use a crystal. The problem is that I can't get
it to program. The MPASM directive
__CONFIG _HS_OSC
is supposed to do that. But, when I try to program the PIC with the hex file
generated with that command, the programmer pukes on it. It adds a line,
second to the bottom, that has the 3FFE word that needs to be programmed. I
looked up the Intel Hex format just to see if it was a problem with the HEX
file, but it looks fine.
Any idea why the programmer would not want to program a high byte like that?
The programmer is working to some extent as I can run the code programmed to
it using an RC oscillator.
Thanks
Mike M.
Palm Harbor, FL

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\09\01@113820 by Michael Maiorana

flavicon
face
> A "bare" oscilliscope probe can kill the oscillations.  A X10 probe
usually
> works.

Olin, I did use a 10x probe.

> > __CONFIG _HS_OSC
>
> At 4 MHz, you should probably be using the XT oscillator mode.

Ok, I'll try that after I figure out why I can't program the config
register.
Thanks
Mike M.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\09\01@114312 by Andrew E. Kalman

flavicon
face
Hi Mike.

Re:
>Any idea why the programmer would not want to program a high byte like that?
>The programmer is working to some extent as I can run the code programmed to
>it using an RC oscillator.

Which programmer? Make sure it's got the proper chip type selected.

Also, as Olin pointed out, the HS setting is for high-speed clocks.
Perhaps it won't barf with XT?

Lastly (I don't use MPASM since I write in C) perhaps you haven't
specified all the required CONFIG parameters? Maybe has something to
do with code protection, etc.

Regards,
--

 ______________________________________
  Andrew E. Kalman, Ph.D.   aekspamKILLspampumpkininc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\09\01@141744 by Alexandre Domingos F. Souza

flavicon
face
>Thanks for reading this. I'm trying to get started playing with PIC's and
>I'm having some difficulty. I have been unable to find any help in the FAQ
>or the archives (archive searches are failing).
>Here is what I did.

       Just a little point that probably does not apply to your situation, but has pissed me a lot some time ago

       In the beginning, I had the same trouble with NoPPP and NoPPP95 (BTW, where Rafael Cabezas is??). If I selected the XT crystal, the circuit NEVER would work. I have to select first one kind of crystal, and after the XT type. If I select directly the XT type, the pic gets programmed incorrectly. Maybe it helps ;o)


---8<---Corte aqui---8<----

Alexandre Souza
.....taitoKILLspamspam.....terra.com.br
http://planeta.terra.com.br/lazer/pinball/

---8<---Corte aqui---8<----

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\09\02@003322 by cision Electronic Solutions

flavicon
face
Mike,
I recently had a similar problem, but don't recall the exact configuration
required to fix it. I don't believe it has anything to do with the
oscillator setting.  What I believe is happening is that you need to turn
off the debugger and make sure that you are programming flash.  Look in the
Options settings for the ICD and turn off the debugger.  Try programming.
It may take some playing around or someone here can fill in my gaps.
Good Luck,
Ed

{Original Message removed}

2001\09\02@192950 by cision Electronic Solutions

flavicon
face
Never mind.  8^(

-----Original Message-----
From: pic microcontroller discussion list
[EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU]On Behalf Of Michael Maiorana
Sent: Friday, August 31, 2001 10:00 PM
To: PICLISTspamspam_OUTMITVMA.MIT.EDU
Subject: [PIC]: trouble getting started

....
I built the parallel port flash pic programmer from
http://www.rotgradpsi.de/mc/picproge.html#UnterstuetztePICs

....

Mike,
I recently had a similar problem, but don't recall the exact configuration
required to fix it. I don't believe it has anything to do with the
oscillator setting.  What I believe is happening is that you need to turn
off the debugger and make sure that you are programming flash.  Look in the
Options settings for the ICD and turn off the debugger.  Try programming.
It may take some playing around or someone here can fill in my gaps.
Good Luck,
Ed

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2001\09\03@201830 by Tony Nixon

flavicon
picon face
Michael Maiorana wrote:

Hi Michael,

It looks like the simple code for the ROMzap LED flash routine.

Try adding this to the ASM file....

       include "P16f870.inc"  ; use definition file for 16F870

;
; ------------------
; CONFIGURATION FUSE
; ------------------
;
       __CONFIG _CP_OFF & _WRT_ENABLE_ON & _HS_OSC & _WDT_OFF & _PWRTE_OFF &
_BODEN_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF

Please note, that this must appear all on one line.

It should set up the chip to run as you intend.


The HS mode should work at 4MHz. I have never had trouble with this, but
have with XT mode at 4MHz. I guess it's the boundary point for these two
choices.






--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
KILLspamsalesKILLspamspambubblesoftonline.com

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...