Searching \ for '509 flasher' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/mems.htm?key=flash
Search entire site for: '509 flasher'.

Truncated match.
PICList Thread
'509 flasher'
1999\12\08@082743 by Graham North

flavicon
face
I have tried this program and it will not work!  (shown below)

Pins 6 and 7 are doing something, but they only switch between 0 and around
1.7 volts!

It is wired up like this:

Pin 1 +5V
Pin 2 NC
Pin 3 NC
Pin 4 NC
Pin 5 NC
Pin 6 ---------/\/\/\/\/\---------|>|---------Gnd
                       330 ohm

Pin 7 as pin 5
Pin 8 Gnd

Have you any ideas?

Graham


              LIST    P=12C509
              RADIX   DEC
              INCLUDE <P12C509.INC>
              CBLOCK  0X0007
                      LOOP1
              ENDC
             __CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _IntRC_OSC
              ORG     0X3FF
              MOVLW   0X80
              ORG     0X0000
              MOVWF   OSCCAL
              GOTO    START
       DLY100 MOVLW   100
       DLYMS  MOVWF   LOOP1
       DY0    MOVLW   -125
              MOVWF   TMR0
       DY1    MOVF   TMR0,W
              IORLW   0
              BTFSS   STATUS,Z
              GOTO    DY1
              DECFSZ  LOOP1,F
              GOTO    DY0
              RETLW   0
       DIT    BSF     GPIO,0
              BSF     GPIO,1
              CALL    DLY100
              BCF     GPIO,0
              BCF     GPIO,1
              CALL    DLY100
              CALL    DLY100
              RETLW   0
       DAH    BSF     GPIO,0
              BSF     GPIO,1
              CALL    DLY100
              CALL    DLY100
              CALL    DLY100
              BCF     GPIO,0
              BCF     GPIO,1
              CALL    DLY100
              CALL    DLY100
              RETLW   0
       SENDSPACE  CALL  DLY100
              CALL  DLY100
              CALL  DLY100
              CALL  DLY100
              RETLW 0
              ORG     0X0100
       START  MOVLW   B'11000010'
              MOVLW   0
              MOVWF   GPIO
              MOVLW   0
              TRIS    GPIO
              OPTION
       LOOP
       ;
       ;T
              CALL DAH
              CALL SENDSPACE
       ;H
              CALL DIT
              CALL DIT
              CALL DIT
              CALL DIT
              CALL SENDSPACE
       ;I
              CALL DIT
              CALL DIT
              CALL SENDSPACE
       ;S
              CALL DIT
              CALL DIT
              CALL DIT
              CALL SENDSPACE
       ;SPACE
              CALL SENDSPACE
              CALL SENDSPACE
       ;I
              CALL DIT
              CALL DIT
              CALL SENDSPACE
       ;S
              CALL DIT
              CALL DIT
              CALL DIT
              CALL SENDSPACE
       ;SPACE
              CALL SENDSPACE
              CALL SENDSPACE
       ;A
              CALL  DIT
              CALL  DAH
              CALL SENDSPACE
       ;SPACE
              CALL SENDSPACE
              CALL SENDSPACE
       ;T
              CALL DAH
              CALL SENDSPACE
       ;E
              CALL DIT
              CALL SENDSPACE
       ;S
              CALL DIT
              CALL DIT
              CALL DIT
              CALL SENDSPACE
       ;T
              CALL DAH
              CALL SENDSPACE
              CALL    SENDSPACE
              CALL    SENDSPACE
              GOTO    LOOP
              END

1999\12\08@094906 by McMeikan, Andrew

flavicon
face
instead of driving the anode of the LED turn it around so you drive the
cathode with the other end to 5v.
the PIC can sink more than it can source.

       cya,    Andrew...

> {Original Message removed}

1999\12\08@100351 by Graham North

flavicon
face
1.7 volts is still present with the led disconnected!

       ----------
       From:  McMeikan, Andrew [SMTP:spam_OUTandrew.mcmeikanTakeThisOuTspamMITSWA.COM.AU]
       Sent:  08 December 1999 13:59
       To:  .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
       Subject:  Re: 509 flasher
       Sensitivity:  Confidential

       instead of driving the anode of the LED turn it around so you drive
the
       cathode with the other end to 5v.
       the PIC can sink more than it can source.

               cya,    Andrew...

       > {Original Message removed}

1999\12\08@102052 by Jason Harper

picon face
>               __CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _IntRC_OSC

Aren't you supposed to combine configuration flags with '|' or '+', not
'&'?  ANDing together a series of bit flags is guaranteed to give you a
zero - I'm not sure exactly what effect a zero has as the configuration
word, but I suspect it's setting the PIC for an external clock or something
else incompatible with how you've wired your circuit.

>         START  MOVLW   B'11000010'
>                MOVLW   0
>                MOVWF   GPIO
>                MOVLW   0
>                TRIS    GPIO
>                OPTION

That first MOVLW is accomplishing nothing, since you immediately overwrite
W with a zero.  I suspect that the value 11000010 was intended to go into
the OPTION register, but you inserted some other code in between.  The main
effect of your storing 0 in OPTION instead is to set the Timer0 prescaler
to 1:2 instead of 1:8.  This would make your LED blink 4 times as fast as
it should, but wouldn't explain why it doesn't work at all - I'm pretty
sure that the config word is your real problem.
       Jason Harper

1999\12\08@104330 by Michael Rigby-Jones
flavicon
face
part 0 8208 bytes
<P><FONT SIZE=2 FACE="Arial">Aren't you supposed to combine configuration flags with '|' or '+', not</FONT>
<BR><FONT SIZE=2 FACE="Arial">'&amp;'?&nbsp; ANDing together a series of bit flags is guaranteed to give you a</FONT>
<BR><FONT SIZE=2 FACE="Arial">zero - I'm not sure exactly what effect a zero has as the configuration</FONT>
<BR><FONT SIZE=2 FACE="Arial">word, but I suspect it's setting the PIC for an external clock or something</FONT>
<BR><FONT SIZE=2 FACE="Arial">else incompatible with how you've wired your circuit.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; START&nbsp; MOVLW&nbsp;&nbsp; B'11000010'</FONT>
<BR><FONT SIZE=2 FACE="Arial">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVLW&nbsp;&nbsp; 0</FONT>
<BR><FONT SIZE=2 FACE="Arial">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVWF&nbsp;&nbsp; GPIO</FONT>
<BR><FONT SIZE=2 FACE="Arial">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVLW&nbsp;&nbsp; 0</FONT>
<BR><FONT SIZE=2 FACE="Arial">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRIS&nbsp;&nbsp;&nbsp; GPIO</FONT>
<BR><FONT SIZE=2 FACE="Arial">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OPTION</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">That first MOVLW is accomplishing nothing, since you immediately overwrite</FONT>
<BR><FONT SIZE=2 FACE="Arial">W with a zero.&nbsp; I suspect that the value 11000010 was intended to go into</FONT>
<BR><FONT SIZE=2 FACE="Arial">the OPTION register, but you inserted some other code in between.&nbsp; The main</FONT>
<BR><FONT SIZE=2 FACE="Arial">effect of your storing 0 in OPTION instead is to set the Timer0 prescaler</FONT>
<BR><FONT SIZE=2 FACE="Arial">to 1:2 instead of 1:8.&nbsp; This would make your LED blink 4 times as fast as</FONT>
<BR><FONT SIZE=2 FACE="Arial">it should, but wouldn't explain why it doesn't work at all - I'm pretty</FONT>
<BR><FONT SIZE=2 FACE="Arial">sure that the config word is your real problem.</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Jason Harper</FONT>
</P>
</UL>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">I did notice that the program is full of instances of consecutive bit operations on the GPIO port, never a good thing to do.</FONT></P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Also I think the delay routine may be a bit dodgy.&nbsp; The coments are mine, but I'm trying to illustrate the fact that to work properly, the timer would have to roll over to zero exactly as the MOVF TMR0,W instruction is being executed.&nbsp; It's hardly worth using the timer for delays like this.&nbsp; As you are using 100% cpu time polling the timer, you might just as well use a pure software delay.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">DLY100&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVLW&nbsp;&nbsp; 100&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; do 100 timer loops</FONT>
<BR><FONT SIZE=2 FACE="Arial">DLYMS &nbsp; MOVWF&nbsp;&nbsp; LOOP1&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2 FACE="Arial">DY0&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVLW&nbsp;&nbsp; -125&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; pre-load TMR0 with -125</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">MOVWF&nbsp;&nbsp; TMR0</FONT>
<BR><FONT SIZE=2 FACE="Arial">DY1&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVF&nbsp;&nbsp; TMR0,W&nbsp;&nbsp; ; grab TMR0 register (timer must be zero here to work properly)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">IORLW&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; is it zero?&nbsp; (might roll over to zero here)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">BTFSS&nbsp;&nbsp; STATUS,Z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (or here)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">GOTO&nbsp;&nbsp;&nbsp; DY1&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; no check again (or here)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">DECFSZ&nbsp; LOOP1,F ; yes, decrement outer loop</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">GOTO&nbsp;&nbsp;&nbsp; DY0</FONT>
</P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">The fact that the voltage on the ports is rising to 1.7 volts suggests that the pin is configured as an input and is floating.&nbsp; This ties in with the incorrect CONFIG.&nbsp; The ports default to input on power up, and if the PIC isn't running it'll never get configured as an output.</FONT></P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Mike</FONT>
</P>
<BR>

</BODY>
</HTML>
</x-html>

1999\12\08@143435 by MEDICINTEKNIK KB

picon face
Hi Graham !

If you write:


       DLY100 MOVLW   100
       DLYMS  MOVWF   LOOP1
       DY0    MOVLW   -125
              MOVWF   TMR0

I guess you do the loop 0 times. The name of it indicates that you want to loop 100 times, but 100 Hex is 256 Dec. This is more than the W Reg can handle (8 bit processor - right ?) so - I think you actually load 0 .

With the MPASM .100 is one hundred; it looks to me like you meant to write    -100 (I'm not familiar with the various assemblers around).

Blinks now ?



Sven in Sweden

1999\12\08@171105 by John C. Frenzel

picon face
Are you sure that this chip is even programmed?  Have you been able to read
out the HEX file from the chip.  It sitting dead on the board at 1.7v makes
me think that it is not even running.  Did you select the correct
clock/crystal option?  Could you program another piece so as to rule out a
static kill.
Keep Hacking
John


__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com

1999\12\08@194134 by Tony Nixon

flavicon
picon face
Hi Graham,


This code definitely works on my 12C509.

Plonk it into MPASM (or whatever) and compile it. Then program your
chip.
A LED connected to GPIO 1 (pin6) through a 330R resistor to ground
should flash at about a 1/2 second rate when you connect power.

If yours does not work there will be other problems. Verify your chip
after programming and make sure your circuit connections are correct.

If it does work, try integrating some of your code into this, a little
at a time, until you get it all going.

The prescaler setting has been changed to allow the code to detect when
TMR0 = 0. To get a faster flash rate change the value of "LOOP1".


       LIST    P=12C509
       RADIX   DEC
       INCLUDE <P12C509.INC>
       CBLOCK  0X07
         LOOP1
       ENDC
       __CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _IntRC_OSC

       ORG     0X3FF
       MOVLW   0X80

       ORG     0X0000
       MOVWF   OSCCAL
       GOTO    START


DELAY   MOVF TMR0,w     ; TMR0 must be zero for these instructions if the
loop is to work
       BTFSS STATUS,Z  ; TMR0 must be zero for these instructions if the loop
is to work
       GOTO DELAY      ; TMR0 must be zero for these instructions if the loop
is to work
       DECFSZ LOOP1
       GOTO DELAY
       RETLW 0


START   MOVLW   0       ; set al pins = 0
       MOVWF   GPIO
       MOVLW   0       ; set all pins as outputs
       TRIS    GPIO
       MOVLW B'11010010'       ; TMR0 internal clock, PRESCALER 1:4
       OPTION

FLASH   MOVLW B'00000010'
       XORWF GPIO
       CLRF LOOP1      ; LOOP1 value determines delay. 0 = MAXIMUM
       CALL DELAY
       GOTO FLASH

       END


--
Best regards

Tony

http://www.picnpoke.com
salesspamKILLspampicnpoke.com

1999\12\09@031802 by Jinx

face picon face
Um, are you sure it's a good LED ?

Jinx

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