Searching \ for '[PIC] Increasing LED Intensity.' 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/displays.htm?key=led
Search entire site for: 'Increasing LED Intensity.'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Increasing LED Intensity.'
2005\10\22@144716 by Rolf

face picon face
Hi all.

I have just completed a "prototype" project (hobby), that is an
Infra-Red remote control for a Nikon D70s camera. The primary motivation
is to create an "extended range" relative to the remote that Nikon sells
(I set the camera on a tripod, focussed on a bird feeder. I want to be
really far away and still trigger the camera... maybe even set up a
motion detector ... ;-).

Right now it is working, but it's range is "only on par" with the Nikon
remote (and a lot more clunky ;-).

I have a bunch of IR LED's available. They are 100ma with 1V volt drop.
They have a 20deg "half-intensity" beam angle. I am using 2 AAA cells to
power the system (nominal 3V).
Because the IR Signal is a 40KHz 50% duty cycle when on, and for each
"trigger" it will only be on (at 40KHz) for 8ms for the complete trigger
sequence of 85ms, I believe I could exceed the 100mA "continuous"
rating. It's "pulse" rating is something like 10A for a few uSec.

I am using a 16F628A with INTOSC@4MHz

To Drain the current of 100mA, I am using 4 PORTB pins as a sink (25mA
current per pin as per datasheet). My calculations indicate that to get
100ma through the LED with 1V forward, and 3V system, I need 20Ohm
resistance. To sink that through 4 pins, I connected an 82 Ohm resistor
to each pin, and then the LED through the 4 parallel resistors, giving a
net parallel resistance of about 20Ohm.

Now, for my questions.....

1.) How do I get better range on the IR remote?

Options I have considered....:
  i) Drive the IR-LED at more than 100mA (add another PORTB Pin to sink
current to?) If so, how High can I go?
 ii) Add another IR-LED (either in parallel with first? or as a
seperate system entirely?)
iii) Get a "brighter" IR-LED?
iv) Add another AAA cell, run the system at 4.5V?
 v) Get a "narrower beam" IR-LED.

Which avenue holds the most promise? Is there an option I have not
considered?

2) What is the math for 2 LED's in parallel....? To get 100mA through
each LED I'd need to sink 200mA. Probaby use an external transistor for
that.... not PIC Pins. Would it be better to use 2x20 Ohm resistance one
for each LED, or could I use a single 10 Ohm resistance common to both
LED's?

3) Why does it not work well at "close range" < 6inches or so from
Camera. Is it possible to "flood" an IR receiver?

I know that I have given a lot of detail. Hopefully someone with more
experience than me at "real-world" electronics can bring their
experience to bear on my challenge... ;-)

Thanks in advance.

Rolf

2005\10\22@161900 by Matthew Miller

flavicon
face
On Sat, Oct 22, 2005 at 02:46:38PM -0400, Rolf wrote:
> Hi all.
>
> I have just completed a "prototype" project (hobby), that is an
> Infra-Red remote control for a Nikon D70s camera. The primary motivation
> is to create an "extended range" relative to the remote that Nikon sells
> (I set the camera on a tripod, focussed on a bird feeder. I want to be
> really far away and still trigger the camera... maybe even set up a
> motion detector ... ;-).
>
> Right now it is working, but it's range is "only on par" with the Nikon
> remote (and a lot more clunky ;-).

Since you already have your remote working, I think the best thing you could
do is to install a system of lenses either on the remote or in front of the IR
receiver on the camara. This way you won't have to modify your circuit.

You didn't say how far away you want to use the remote, but there is going
to be a distance where using lenses is the only reasonable solution.

Good luck.

Matthew

--
"Protecting the children is a good way to get a lot of adults who can't
stand up for themselves"  -- J. Stecher

2005\10\22@163114 by Spehro Pefhany

picon face
At 02:46 PM 10/22/2005 -0400, you wrote:
{Quote hidden}

Have you put an oscilloscope across any of the resistors to see what
current you are
actually getting? I suspect a lot less than 100mA total, both because of
the PIC at
such a low power supply voltage and because I suspect the voltage drop of
the IRLED
is a fair bit greater than 1V at anything like 100mA.

You should probably use a very low voltage MOSFET (eg. Zetex ZXMN2A02N8, which
has 40mohm Rds(on) at Vgs=2.5V) or a bipolar (eg. Sziklai pair-- cheaper)
to drive the LEDs, with a single port pin.  After you get it working at ~100mA
(assuming your LED is actually rated to work at that current) you can
re-evaluate the range and see if you need to do anything more.

If you do decide to use more than one LED, it's best to use a separate
resistor for each to ensure that the current splits more evenly.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
spam_OUTspeffTakeThisOuTspaminterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff


2005\10\22@181451 by Rolf

face picon face
I wish I had an Oscilloscope ... Anyone selling one cheap?

I have the specs on the LED and they are rated at 100mA continuous. The
circuit is simple, and mounted on a "sea-of-holes" just 7 x 20 with room
to spare... 6 resistors + 1 F628A. There is no circuit board (and will
never be). I have lots of space to solder/desolder. My biggest issue is
that I am unfamiliar with the parts available... I have to learn what a
Sziklai pair is, and if my (small) local electronics store has it. I
have no training in real electronics... I am a computer programmer doing
this "for fun". I have interest, but no experience....

I do have an opto-coupler on hand (excess from another "learning"
project), and that will probably do the trick... worth a try (I was
planning on using it to drive multiple LED's at 100mA each). I believe
the switching time would be fine. Need to (re-)read the specs on it though.

I am hoping for a range greater than 20 meters ( 50' ).

Thanks for a new avenue of research...

Rolf

Spehro Pefhany wrote:

{Quote hidden}

2005\10\24@102323 by Mike Hord

picon face
You should probably be driving the LED with a transistor
of some sort...FET, BJT, whatever, but multiple PIC
pins isn't the best option.  That'll let you kick up your
drive current, which you can easily do for a pulsed LED
like that.

Have you filtered visible light on the receiver end?  Try
using the blank bits of developed film left on the
negatives you get back from the photomat.  That stops
a lot of visible light but is quite transparent to IR.

20 meters should be quite possible.  I see remotes
that work across 10 on a daily basis, no problem.

Mike H.

2005\10\27@231549 by Rolf

face picon face
Hi all, and thanks for the assistance.

IR Remote now has about 30+ meter range (at night, +- 3deg celcius), at
least twice the range of the Nikon remote (same conditions).

For the record. I upgraded to 9V battery with an LM78L05 for the PIC (9V
through the IR LED's). Used 2 IR LEDs, with them both being driven at
very high current (1V forward voltage on LED, 9V nominal, 20Ohm
resistance = 400mA through each LED (very short pulses though). Rated at
100mA continuous. These are being driven by BS170 MOSFET by a 12F675

My first complete "real" project.

Takes bow....

Now, I have just one question, somewhat off topic....

Anyone know how to "broaden" the reception of an IR Receiver. The D70
seems to have a very "directional" receiver. More than about 15 degrees
either side of where the lens is pointing, and the receiver does not
activate (for neither my remote, nor the Nikon one...). I am reluctant
to open the camera (will not happen), but I am open to suggestions of
putting some lens or something to accomplish the broadening.

Thanks

Rolf


Rolf wrote:

{Quote hidden}

2005\10\27@235903 by Spehro Pefhany

picon face
At 11:15 PM 10/27/2005 -0400, you wrote:
>Hi all, and thanks for the assistance.
>
>IR Remote now has about 30+ meter range (at night, +- 3deg celcius), at
>least twice the range of the Nikon remote (same conditions).

Are you planning on writing this up? I happen to have a D70 as well and
have not gotten the remote yet.

{Quote hidden}

What about a Fresnel lens or diffuser in front of the receiver lens?

You could try a bit of frosted or pebbled clear plastic. A Fresnel
lens out of a duff motion detector etc. How about scuffing up a bit of
clear sticky tape with emery paper and sticking it over the receiver?

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffspamKILLspaminterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff


2005\10\28@000729 by Robert Rolf

picon face
Clear polyethylene diffuser will broader the detector angle.
Penalty is lower sensitivity. You could also use ping pong
ball material, but it has significant attenuation.

You basically want to put something in front of the detector
that will catch rays from farther off axis and put them where
the detector will see them. I use dull side of aluminum foil
on my stereo gear so I can hit it from my office at 80 degree
angle.

Rolf wrote:

> Hi all, and thanks for the assistance.
>
> IR Remote now has about 30+ meter range (at night, +- 3deg celcius), at
> least twice the range of the Nikon remote (same conditions).

You could also have modified the Nikon remote to drive it's LED
harder. They underdrive it to get good battery life so dropping the
LED series R would get you more range.

{Quote hidden}

2005\10\28@000921 by Robert Rolf

picon face
Spehro Pefhany wrote:

> At 11:15 PM 10/27/2005 -0400, you wrote:

> What about a Fresnel lens or diffuser in front of the receiver lens?
>
> You could try a bit of frosted or pebbled clear plastic. A Fresnel
> lens out of a duff motion detector etc. How about scuffing up a bit of
> clear sticky tape with emery paper and sticking it over the receiver?

Or use 3M 'invisible tape' for books, which is clear and already rough.

R


2005\10\28@020028 by Chen Xiao Fan

face
flavicon
face
One thing I am not so sure is about the forward voltage drop, 1V
seems to be a bit low. Normally IR LED drop is lowed than visible
red LED but it is still in the range of 1.5V when pulsing at
200mA. Are you sure that it is 1V? It is possible you can
pulse the IR LEDs with even higher current depending on the
duty cycle and the period.

To broaden the opening angle of the receiver, somehow you need
to de-focus the emitter which may reduce the sensing distance.
It is also possible to widen the aperture of the receiver but I
think that is not an option for you since you do not want to
open the D70 (not so cheap).

Regards,
Xiaofan

{Original Message removed}

2005\10\28@040955 by Alan B. Pearce

face picon face
> What about a Fresnel lens or diffuser in front of the receiver lens?
>
> You could try a bit of frosted or pebbled clear plastic. A Fresnel
> lens out of a duff motion detector etc. How about scuffing up a bit of
> clear sticky tape with emery paper and sticking it over the receiver?

My immediate thought was a piece of the ribbed plastic that is used in front
of those pictures you used to get as a kid, where the scene changed as you
changed the viewing angle. These typically had what amounts to ribs that
make a fresnel lens type effect in one direction, but not in the 90 degree
direction.

2005\10\28@103059 by Rolf

face picon face
part 0 44 bytes
his is a multi-part message in MIME format.
part 1 2225 bytes content-type:text/plain; charset=ISO-8859-1; format=flowed (decoded 7bit)

Thanks all... those suggestions seem easy to try... (gets out 3m
"frosted" tape....)

Holy ...!  much better reception angle. The floor I work on is not big
enough to test whether the range is reduced (presumably it is...)

I got my inspiration from http://www.alanmacek.com/nikon/ who also
references http://www.bigmike.it/ir-control.html
You will want to look at those pages.

Alan uses a 12F675 (which I use as well...). He uses the trigger
momentary switch to actually turn on the power to the circuit. I chose
to use the trigger as an input mechanism on an input pin instead, and
have a slide switch to power the system instead. Alan's mechanism
introduces a noticable delay as the Oscilator starts up, and the PIC
initializes. My system has more "instant" trigger response.
Additionally, Alan can only drive 25mA through the LED because he
sources the current through the PIC. I have used MOSFETS to drive the
LED's at about 800mA each.

The general overview is:
On the 12F675, there are 8 pins... in order:
1. Vdd
2. Output to trigger MOSFETs
3. Output to flash power-on LED
4. NC (Vpp - ICSP)
5. Input - pull-up resistor attached, and momentary "trigger" switch
which pulls it low.
6. NC (PCLK - ICSP)
7. NC (PDAT - ICSP)
8. Vss

Attached is schematic, and source code. TinyCAD does not have a "Ground"
in it's standard library, so there are some "AC Symbols" instead.

One other thing... the Oscillator Callibration for *my* chip is 0x74.
You will have to change that value for your chip.

Please all, feel free to critique my code, I would appreciate more
experienced opinions...

Things I know are issues so far:
I use old style __CONFIG
I could use more compact CycleOFF code

Cheers

Rolf



Spehro Pefhany wrote:

{Quote hidden}

[snip]


part 2 12705 bytes content-type:text/plain;
(decoded 7bit)

;**********************************************************************
;   This file is a basic code template for object module code         *
;   generation on the PICmicro PIC12F675. This file contains the      *
;   basic code building blocks to build upon.  As a project minimum   *
;   the 12F675.lkr file will also be required for this file to        *
;   correctly build. The .lkr files are located in the MPLAB          *
;   directory.                                                        *
;                                                                     *
;   If interrupts are not used all code presented between the         *
;   code section "INT_VECTOR and code section "MAIN" can be removed.  *
;   In addition the variable assignments for 'w_temp' and             *
;   'status_temp' can be removed.                                     *
;                                                                     *
;   Refer to the MPASM User's Guide for additional information on     *
;   features of the assembler and linker (Document DS33014).          *
;                                                                     *
;   Refer to the respective PICmicro data sheet for additional        *
;   information on the instruction set.                               *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Filename:      main.asm                                           *
;    Date:          2005-10-25                                        *
;    File Version:  1.0                                               *
;                                                                     *
;    Author:        Rolf Lear                                         *
;    Company:       Hobby                                             *
;                                                                     *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Files required:                                                  *
;                    12F675.lkr                                       *
;                                                                     *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Notes:                                                           *
;                                                                     *
;   2250us on (40khz modulated)
;   27600us off (no signal)
;   650us on
;   1375us off
;   575us on
;   3350us off
;   650us on
; -- repeated a second time after 63ms

;   40KHz implies a 25us cycle time,
;   or  12.5us on, then 12.5us off.
;   each instruction cycle is 1us@4MHz, thus, we approximate.
;   and use 13us on, 12us off.
;                                                                     *
;  COPYRIGHT: Rolf Lear. 2005                                         *
;     Please e-mail me at .....learrKILLspamspam.....rogers.com before using this code.    *
;     Free for non-commercial use.                                    *
;                                                                     *
;   ... always wanted to do something like that...                    *
;**********************************************************************

   list      p=12f675            ; list directive to define processor
   #include <p12f675.inc>        ; processor specific variable definitions

   errorlevel  -302              ; suppress message 302 from list file

   __CONFIG   _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT  

; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.


#define BLKBIT  4
#define BLINK   GPIO,4
#define IRBIT   5
#define IRLED   GPIO,5
#define TRGBIT  2
#define TRIGGER GPIO,2

;***** VARIABLE DEFINITIONS (examples)

; example of using Shared Uninitialized Data Section
INT_VAR     UDATA_SHR   0x20  
CCY         RES     1       ; Cycle count register
CCT         RES     1       ; Cycle tempw
BLC         RES     1       ; Blink Counter.


;**********************************************************************
RESET_VECTOR    CODE    0x000       ; processor reset vector
       goto    start              ; go to beginning of program


MAIN    CODE
; these first 4 instructions are not required if the internal oscillator is not used
start
       ;call   0x3FF           ; retrieve factory calibration value
       ; My chip returns 0x74
       banksel OSCCAL          ; set file register bank to 1
       movlw   0x74
       movwf   OSCCAL            ; update register with factory cal value


; remaining code goes here

       banksel INTCON
       bcf     INTCON,GIE      ; ensure no interrupts.

; Set the various pins... there are only 8 ;-)
       banksel GPIO
       clrf    GPIO            ;
       
       movlw   07h
       banksel CMCON
       movwf   CMCON           ; turn off comparator.

       banksel ADCON0
       clrf    ADCON0          ; turn off A/D module.

       banksel ANSEL
       clrf    ANSEL           ; make all pins digital.

       banksel TRISIO          ;
       movlw   0xff
       movwf   TRISIO
       bcf     TRISIO,IRBIT    ; set the IRPIN to output.
       bcf     TRISIO,BLKBIT
       
       movlw   0ffh            ; Enable all weak-pullups.
       banksel WPU             ; actually, the TRISIO above will
       movlw   WPU             ; not allow pull-up on output pins

       banksel IOC
       clrf    IOC             ; disable all IO interrupts.

; OK, init complete...
; lets actually do something.

       banksel GPIO            ; get back to GPIO bank,
                               ; the only file we modify now.


; OK, init complete...
; lets actually do something.

       ;goto Remote


       movlw   20      ; reset the counter to 20 blink cycles.
       movwf   BLC     ;
       bsf     BLINK   ; turn on LED
BlinkLoop
       btfss   TRIGGER ; test switch...
       call    Remote
       call    Delay
       btfss   TRIGGER ; test switch...
       call    Remote
       bcf     BLINK   ; turn off LED
       decfsz  BLC
       goto    BLOff
       bsf     BLINK   ; turn on LED
       movlw   20      ; reset the counter to 20 blink cycles.
       movwf   BLC     ;
BLOff   call    Delay
       goto    BlinkLoop

Delay   ; exact 50ms
       movlw   66
       movwf   CCY
       movlw   192
       movwf   CCT
       goto    $+1 ; 2 x nop
DelayLoop
       decfsz  CCY,1
       goto $+2
       return
       decfsz  CCT,1
       goto $-1
       goto DelayLoop      



;   2250us on (40khz modulated)
;   27600us off (no signal)
;   650us on
;   1375us off
;   575us on
;   3350us off
;   650us on
; wash, rinse, repeat. after 63us

Remote
       bcf     BLINK

       call Sequence

       ; wait 63,000us. or 2520 cycles. = 9x256 + 216 cycles.

       movlw   216
       movwf   CCY
       call    CycleOff        
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff
       movlw   0
       movwf   CCY
       call    CycleOff

       call Sequence

       
       bsf     BLINK
       call    Delay
       call    Delay
       call    Delay
       call    Delay
       bcf     BLINK
       call    Delay
       call    Delay
       bsf     BLINK
       call    Delay
       call    Delay
       call    Delay
       call    Delay
       bcf     BLINK
       call    Delay
       call    Delay
   return

Sequence
       movlw   90              ; 90 x 25us = 2250us ON.
       movwf   CCY
       call    CycleOn

       
       movlw   80              ; gives 1104 cycles in total = 27600us
       movwf   CCY             ;
       call    CycleOff        ;     80
       movlw   0
       movwf   CCY
       call    CycleOff        ;    256
       movlw   0
       movwf   CCY
       call    CycleOff        ;    256
       movlw   0
       movwf   CCY
       call    CycleOff        ;    256
       movlw   0
       movwf   CCY
       call    CycleOff        ;    256
                               ; ------
                               ;   1104
       
       movlw   26              ; 26 x 25us = 650us ON.
       movwf   CCY
       call    CycleOn
       
       movlw   55              ; 55 x 25us = 1375us Off.
       movwf   CCY
       call    CycleOff
       
       movlw   23              ; 23 x 25us = 575us ON.
       movwf   CCY
       call    CycleOn
       
       movlw   134             ; 134 x 25us = 3350us Off.
       movwf   CCY
       call    CycleOff
       
       movlw   26              ; 26 x 25us = 650us ON.
       movwf   CCY
       call    CycleOn

   return

CycleOn     ; This will always take the exactly 25 x CCY mcu cycles to complete
           ; LED will be on at a 13/25 duty cycle ... 52%
       ;nop                    ; 22 Every call has a 2-instruction setup movlw
       ;nop                    ; 23 second instruction is movwf
       ;nop                    ; 24 Every call has 2 instruction call.
       ;nop                    ; 25 part 2 of call...
       bsf     IRLED           ; 1 open FET...
       goto    $+1             ; 2/3
       goto    $+1             ; 4/5
       goto    $+1             ; 6/7
       goto    $+1             ; 8/9
       goto    $+1             ; 10/11
       goto    $+1             ; 12/13
       bcf     IRLED           ; 14 Set pin low. - close FET.
       nop                     ; 15
       goto    $+1             ; 16/17
       decfsz  CCY,1           ; 18/19 decrement CCY. ; 2 instructions....
       goto    LoopOn          ; 19/20 another 2 cycles
       return                  ; 20/21
LoopOn
       goto    $+1             ; 21/22
       nop                     ; 23
       goto    CycleOn         ; 24/25


CycleOff    ; This will always take the exactly 25 x CCY mcu cycles to complete
           ; LED will be off all the time.
       ;nop                    ; 1 Every call has a 2-instruction setup movlw
       ;nop                    ; 2 second instruction is movwf
       ;nop                    ; 3 Every call has 2 instruction call.
       ;nop                    ; 4 part 2 of call...
       nop ; clrf  PORTB       ; 5 turn OFF LED (make close drain...).
       nop                     ; 6
       nop                     ; 7                
       nop                     ; 8
       nop                     ; 9
       nop                     ; 10
       nop                     ; 11
       nop                     ; 12
       nop                     ; 13
       nop                     ; 14                    
       nop                     ; 15
       nop                     ; 16
       nop                     ; 17
       nop ; clrf  PORTB       ; 18 turn OFF LED (close drain... )
       decfsz  CCY,1           ; 19/20 decrement CCY. ; 2 instructions....
       goto    LoopOff         ; 20/21 another 2 cycles

       nop                     ; 21
       nop                     ; 22                    
       nop                     ; 23
       return                  ; 24/25
LoopOff
       nop                     ; 22                    
       nop                     ; 23
       nop                     ; 24
       nop                     ; 25
       nop                     ; 1   back to start of next loop
       nop                     ; 2
       goto CycleOff           ; 3/4


; initialize eeprom locations

EE      CODE    0x2100
       DE  0x00, 0x01, 0x02, 0x03


       END                       ; directive 'end of program'



part 3 13412 bytes content-type:image/png; (decode)


part 4 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2005\10\28@152806 by Peter

picon face

On Thu, 27 Oct 2005, Rolf wrote:

> Now, I have just one question, somewhat off topic....
>
> Anyone know how to "broaden" the reception of an IR Receiver. The D70 seems
> to have a very "directional" receiver. More than about 15 degrees either side
> of where the lens is pointing, and the receiver does not activate (for
> neither my remote, nor the Nikon one...). I am reluctant to open the camera
> (will not happen), but I am open to suggestions of putting some lens or
> something to accomplish the broadening.

Taking a divergent lens from a throwaway camera's viewfinder and
temporarily securing it in front of the 'eye' of the IR receiver should
help (and reduce range).

Peter

2005\10\28@161422 by Peter

picon face

On Fri, 28 Oct 2005, Spehro Pefhany wrote:

> You could try a bit of frosted or pebbled clear plastic. A Fresnel
> lens out of a duff motion detector etc. How about scuffing up a bit of
> clear sticky tape with emery paper and sticking it over the receiver?

That is not a good idea imho. You want to widen the field of view
without losing energy if possible. A divergent lens added outside
(tacked on) should help, but it will reduce the range.

Peter

2005\10\28@195732 by Jan-Erik Soderholm

face picon face
Rolf wrote :

> One other thing... the Oscillator Callibration for *my* chip is
0x74.
> You will have to change that value for your chip.

Change what ?

Your code :

  ;call   0x3FF           ; retrieve factory calibration value
  ; My chip returns 0x74
  banksel OSCCAL          ; set file register bank to 1
  movlw   0x74
  movwf   OSCCAL            ; update register with factory cal value

should/could be replaced with :

  ;call   0x3FF           ; retrieve factory calibration value
  banksel OSCCAL          ; set file register bank to 1
  movwf   OSCCAL            ; update register with factory cal value

Why care what the actual value is ?
What if you'd like to use that code in 10 or
more processors ?


Regards,
Jan-Erik.



2005\10\28@202303 by Rolf

face picon face
Jan-Erik Soderholm wrote:

{Quote hidden}

Uhmmm... because I was worried that at 3am some morning while my brain
was fried I would erase the chip instead of program it...

Actually, I use the DIY Kit 128 with the "MicroPro" software. This is
one of my first projects, and certainly the first one with a callibrated
Oscilator. I did not know what would happen when I pressed the "Program"
button, so I first  read the chip, wrote the callibration number (with a
sharpie) on to the chip, and in to my code...

I realise now that the MicroPro throws up a warning when  you program
over the callibration value.

There is not much documentation (that I can find) about safe-guarding
the callibration value in the program memory. Can you point me to
something that indicates how to properly deal with the instruction
(RETLW 0x??) at 0x3FF? The 12F675 datasheet just indicates that it is
there. Actually, I only realised it existed because of the code template
in MPLAB, I did all my testing on a 16F628, and then ported it to the
12F675. My reading of the 12F datasheet suddenly became more critical
when I realised that the Oscilator was very different in the 12F675.

Do all programmers use a similar approach to warning the user when
programming the chip that the callibration data is different?

Rolf

2005\10\28@224923 by Spehro Pefhany

picon face
At 10:30 AM 10/28/2005 -0400, you wrote:
>Thanks all... those suggestions seem easy to try... (gets out 3m "frosted"
>tape....)
>
>Holy ...!  much better reception angle. The floor I work on is not big
>enough to test whether the range is reduced (presumably it is...)
>
>I got my inspiration from http://www.alanmacek.com/nikon/ who also
>references http://www.bigmike.it/ir-control.html
>You will want to look at those pages.

<snip>

Thanks for the info, Rolf--

I'll make one up (probably using a resonator for the clock).

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
EraseMEspeffspam_OUTspamTakeThisOuTinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff


2005\10\29@093454 by olin piclist

face picon face
Rolf wrote:
> Uhmmm... because I was worried that at 3am some morning while my brain
> was fried I would erase the chip instead of program it...

Good programming software makes it difficult to just erase the chip without
first reading the calibration value then writing it back afterwards.  You
can't just erase a chip without saving the calibration value using my
PIC_PROG program, for example.  It does perform a bulk erase, but always
reads the calibration value first, writes it to standard output for
reference, does the erase, then write the calibration value back.

> so I first read the chip, wrote the
> callibration number (with a sharpie) on to the chip, and in to my
> code...

On the chip is a good idea, since things can still go wrong.  If power went
down or communication interrupted during the right few 100mS, my programmers
could lose the calibration value also.  In the code is not a good idea
because that code will only work right on one specific chip.  You'll
probably forget all about that when you pick another chip out of the drawer.

> There is not much documentation (that I can find) about safe-guarding
> the callibration value in the program memory. Can you point me to
> something that indicates how to properly deal with the instruction
> (RETLW 0x??) at 0x3FF?

In the linker file specify the program memory range from 0 to 3FFEh instead
of 0-3FFFh.  If you want to you can create a separate region at 3FFFh and
declare it protected.

> Do all programmers use a similar approach to warning the user when
> programming the chip that the callibration data is different?

Actually I think it's not possible to overwrite the calibration value with
my programming software using the default configuration file.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2005\10\29@101044 by Jan-Erik Soderholm

face picon face
Rolf wrote :
> Can you point me to something that indicates how to properly
> deal with the instruction (RETLW 0x??) at 0x3FF? The 12F675
> datasheet just indicates that it is there.

What about "Example 9-1" on page 54 ?
(Page number could be different, I'm not sure I have
the latest datasheet...)

> My reading of the 12F datasheet suddenly became more critical
> when I realised that the Oscilator was very different in the 12F675.

This is one of the nice things with the 8-pin 12F683. It has the
new 8 Mhz INTOSC that is factory callibrated, so there is
no calibration value that can be erased at all. Instead there is
a OSCTUNE register where you can tune the freq aprox +/- 12%
in 32 steps. But the b'00000' (reset value) is always the factory
callibrated freq.

Besides of that, compared with the 12F675, the 12F683 also
have a PWM module, 2 Kword flash and more RAM.
Nice chip....

Jan-Erik.



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