Searching \ for 'writing' 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/index.htm?key=writing
Search entire site for: 'writing'.

No exact or substring matches. trying for part
PICList Thread
'Reading/Writing data EEPROM on 16C84 '
1994\07\03@002203 by manningc

flavicon
face
Enough...

I have spent three evenings trying to write a "hello world" style
program to access the 16C84's data EEPROM.

Can anybody offer some help (eg send source for a very short EEPROM r/w
program)?

Thanx

Charles


'Writing to 16C84 EEPROM data memory'
1996\07\11@181057 by leon
flavicon
picon face
Wanting to use the 16C84 EEPROM data memory, I inserted the following
code into an existing 16C84 program, which is intended to write 12H into
the first location, to try the technique out:

;PUT SOMETHING INTO EEPROM DATA MEMORY

       MOVLW   00H             ;EEPROM ADDRESS TO WRITE TO
       MOVWF   EEADR
       MOVLW   12H             ;EEPROM DATA TO PUT THERE
       MOVWF   EEDATA

;STUFF FROM PAGES 31-32 OF PIC16C84 DATA

       MOVLW   55H
       MOVWF   EECON2
       MOVLW   0AAH
       MOVWF   EECON2
       BSF     EECON1,WR       ;WR = 1
       BSF     EECON1,WREN     ;WREN = 2

After running the program, I put the chip into my programmer and read
the program and EEPROM data memory into the buffers, but the EEPROM data
has not changed. Can someone please tell me what I am doing wrong?

Leon
--
Leon Heller, G1HSM                | "Do not adjust your mind, there is
E-mail spam_OUTleonTakeThisOuTspamlfheller.demon.co.uk  |  a fault in reality": on a wall
Phone: +44 (0)1734 471424         |  many years ago in Oxford.

1996\07\11@204339 by Steve Hardy

flavicon
face
{Quote hidden}

For a start, set WREN before doing anything!
Maybe you've deleted code to save net bandwidth, but remember that
EECON1 and EECON2 are in bank 2 so you will need to change the above
to:

       MOVLW   00H             ;EEPROM ADDRESS TO WRITE TO
       MOVWF   EEADR
       MOVLW   12H             ;EEPROM DATA TO PUT THERE
       MOVWF   EEDATA

       bsf     status,RP0      ; Set bank 1

       BSF     EECON1,WREN     ; Note: this is swapped...
       MOVLW   55H
       MOVWF   EECON2
       MOVLW   0AAH
       MOVWF   EECON2
       BSF     EECON1,WR       ;   ...over from your code!

       bcf     eecon1,wren     ;Disable further writes (does not
                               ; affect current write) if necessary
       btfsc   eecon1,WR
       goto    $-1             ; Loop until write completes
       bcf     status,RP0      ; Back to bank 0, if necessary


{Quote hidden}

One must suggest more careful reading of the manual, since it's all
explained there; and excuse any errors of mine, because I don't have the
manual in front of me.


Regards,
SJH
Canberra, Australia
[who happens to be working on the exact same thing - EEPROM in the '84]

1996\07\12@145119 by leon

flavicon
picon face
In message  <.....9607120046.AA21102KILLspamspam.....keeper.stortek.com> EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU
writes:
> For a start, set WREN before doing anything!
> Maybe you've deleted code to save net bandwidth, but remember that
> EECON1 and EECON2 are in bank 2 so you will need to change the above
> to:
>
>         MOVLW   00H             ;EEPROM ADDRESS TO WRITE TO

[deleted]

Thanks very much to SJH and everyone else who assisted. That part of the
program is working fine, now.

Leon
--
Leon Heller, G1HSM                | "Do not adjust your mind, there is
E-mail leonspamspam_OUTlfheller.demon.co.uk  |  a fault in reality": on a wall
Phone: +44 (0)1734 471424         |  many years ago in Oxford.

1996\07\14@105117 by id John Philip Bodger
flavicon
face
Hi Leon, you wrote:-
>Wanting to use the 16C84 EEPROM data memory, I inserted the following
--Snip--
>After running the program, I put the chip into my programmer and read
>the program and EEPROM data memory into the buffers, but the EEPROM data
>has not changed. Can someone please tell me what I am doing wrong?
>
>Leon
>--
>Leon Heller, G1HSM                | "Do not adjust your mind, there is
>E-mail @spam@leonKILLspamspamlfheller.demon.co.uk  |  a fault in reality": on a wall
>Phone: +44 (0)1734 471424         |  many years ago in Oxford.

Here is some code taken directly from a working program I wrote. It is
written in Parallax Assembler (PASMX) but you should get the idea.
This is a clip of the list output from the assembler and the first column is
line numbers followed by the assembler code words.
You can see from this which PASMX instructions map to multiple Mchip
instructions.
In the great traddition of these things, the simpler lower level routines
are listed first. (n.b. :loop is a local label)
Sorry I didn't have time to translate it for you. I hope it is of some help.
(Contact me direct if there is anything else you need help with Leon -
remember the transputer and QL? - long time no see!)

All the best.

Dave.

 1060                                  ;Routine to write a byte to the EEPROM,
assumes EEADR and EEDATA have
 1061                                  ;already been loaded with the required
values and EEwrenable has already
 1062                                  ;been called to prime the safety
lockout mechanism.
 1063    031D- 138B                    EEwriteit       clrb    GIE
;must run with interrupts disabled
 1064    031E- 1683                                    setb    RP0
;these registers are in page 1
 1065    031F- 3055 0089                               mov     EECON2,#55h
;Required sequence to
activate write
 1066    0321- 30AA 0089                       mov     EECON2,#0AAh    ;55, AA,
set WR.
 1067    0323- 1488                                    setb    WR
 1068    0324- 1E08 2B24               :loop           jnb     EEIF,:loop
;wait until write
is complete
 1069    0326- 1108                                    clrb    WREN
;safe once again !
 1070    0327- 1208                                    clrb    EEIF
;reset indicator for next
time.
 1071    0328- 1283                                    clrb    RP0
 1072    0329- 0009                                    reti
;reenable interrupts when all done
 1073
 1074    032A- 1683                    EEread          setb    RP0
;control register is
in Page 1.
 1075    032B- 1408                                    setb    RD
;initiate read operation
 1076    032C- 1283                                    clrb    RP0
 1077    032D- 0008                                    ret
 1078
 1079    032E- 1683                    EEwrenable      setb    RP0
;EEPROM write
enable safety guard
 1080    032F- 1508                                    setb    WREN
 1081    0330- 1283                                    clrb    RP0
 1082    0331- 0008                                    ret
 1083
 1084    0332- 232E                    EEwrite         call    EEwrenable
 1085    0333- 231D                                    call    EEwriteit
 1086    0334- 0008                                    ret
 1087
 1088                                  ;Get EEPROM data into RAM
 1089                                  ;Enter with R1=source, W=destination,
R2=number of bytes to move
 1090    0335- 0084                    EEget           mov     FSR,W
;start addr of target
regs.
 1091    0336- 0826 0089               :loop           mov     EEADR,R1
;point to byte to
retrieve
 1092    0338- 232A                                    call    EEread
;select read mode
 1093    0339- 0808 0080                               mov     INDIRECT,EEDATA
;load
non-volatile value to working reg
 1094    033B- 0A84                                    inc     FSR
;next indirect address
 1095    033C- 0AA6                                    inc     R1
 1096    033D- 0BA7 2B36                       djnz    R2,:loop
 1097    033F- 0008                                    ret
 1098
 1099                                  ;Put RAM data into the EEPROM.
 1100                                  ;Enter with R1=destination, W=sorce,
R2=number of bytes to move.
 1101    0340- 0084                    EEput           mov     FSR,W
 1102    0341- 0826 0089               :loop           mov     EEADR,R1
;point to byte to store
 1103    0343- 0800 0088                               mov     EEDATA,INDIRECT
;load ram value
to EE reg
 1104    0345- 2332                                    call    EEwrite
 1105    0346- 0A84                                    inc     FSR
;next indirect sorce address
 1106    0347- 0AA6                                    inc     R1
;next destination address
 1107    0348- 0BA7 2B41                       djnz    R2,:loop
 1108    034A- 0008                                    ret


'More on EEPROM Reading and Writing'
1996\08\16@093814 by myke predko
flavicon
face
I've been on vacation for the past two weeks; that's why you haven't heard
too much follow up on this subject.

Brent, thanx for resending the note from Darrell.  Actually, it really
helped me see what was going on.

As it turns out, I *am* writing successfully to the EEPROM.  However, in
doing this, I discovered a couple of things.

The first is, when MPLAB is in "Simulator" mode (as opposed to "Editor"
mode), the EEPROM seems to be programmed always to 0x0FF.  Has anybody else
seen this?  I think this has been the cause of a lot of my problems,
difficulty in understanding what's going on.

The second issue is, the "wrerr" bit always seems to be set after the write.
I have disabled the WDT - which is a fancy way of saying I haven't enabled
it or changed the option register.  And, I execute a "clrwdt" in the final
polling loop.

My code does the following:

 Setup PortB as all Output to 8 LEDs
 display 0x055/0x0AA with delays in between to show that the EEPROM is working
 reads and displays EEPROM address 0
 waits for a button (which pulls down a pull-up) to be pressed
 increments the contents of EEPROM adress 0
 writes the contents back into the EEPROM
 polls EECON1 and displays it's contents in an infinite loop.

I have control over _MCLR, so I can re-run this continuously and see what
happens.  I have been able to read the contents of the EEPROM using PICStart
Plus and MPLAB (in "Editor" Mode).

Now, my next course of action is to see is if "wr" is reset while "wrerr" is
reset.  Could my constant polling of the register be causing a problem?

The code I use to poll is:

Loop
 movlw  0x0FF
 xorwf  EECON1 & 0x07F, w              ;  Get "EECON1" for Display on the LEDs
 bcf    STATUS, RP0
 movwf  PORTB                          ;  Display EECON1 on the LEDs
 bsf    STATUS, RP0
 goto   $

Thanx for everybody's help.

Myke

Do you ever feel like an XT Clone caught in the Pentium Pro Zone?


'How to move cursor without overwriting LCD display'
1997\01\14@121447 by Brooke
flavicon
face
Hi:

I am trying to move the cursor on an LCD display using a 44780
controler chip.  When the cursor moves it seems to be overwriting
the display with it's location.  How to move the corsor and NOT
change the display?

Thanks,
Brooke

1997\01\14@183922 by Peer Ouwehand

flavicon
face
At 09:08 97/01/14 -0800, you wrote:
>Hi:
>
>I am trying to move the cursor on an LCD display using a 44780
>controler chip.  When the cursor moves it seems to be overwriting
>the display with it's location.  How to move the corsor and NOT
>change the display?
>
>Thanks,
>Brooke

All you have to do is change the address of where the cursor
has to be displayed.

Peer.

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
   Peer Ouwehand
   KILLspampouwehaKILLspamspamiaehv.nl
   http://www.iaehv.nl/users/pouweha/

   Wanna chat... try me on PowWow.

   Welcome my son, welcome to the machine. (Pink Floyd)
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

1997\01\14@183929 by Brooke

flavicon
face
Brooke wrote:
>
> Hi:
>
> I am trying to move the cursor on an LCD display using a 44780
>.....

The answer is that the 44780 always either increments or decrements
when the Display Data register ie EITHER read or written.  So I set
the Address Counter one higher than required, setup for decrement,
and READ the DD ram.
> Brooke

1997\01\14@211522 by reddyk

flavicon
face
What code are you using to move the cursor ?
If you are using 32 (space) try sending 20 as an instruction not a
printable character.

Brooke wrote:
>
> Hi:
>
> I am trying to move the cursor on an LCD display using a 44780
> controler chip.  When the cursor moves it seems to be overwriting
> the display with it's location.  How to move the corsor and NOT
> change the display?
>
> Thanks,
> Brooke

1997\01\14@221026 by Brooke

flavicon
face
Peer Ouwehand wrote:
>
> At 09:08 97/01/14 -0800, you wrote:
> >Hi:
> >
> >I am trying to move the cursor on an LCD display using a 44780
> >controler chip.......
>
> All you have to do is change the address of where the cursor
> has to be displayed.

Peer:

Correct.  For some reason it didn't work the first time

Thanks.
Brooke


'16C84 EEPROM writing'
1997\03\24@005724 by David BALDWIN
flavicon
face
Hi,


       I had like to write and read from the EEPROM of the 16C84. I tried to
write at 0x00, and it worked. I tried to do another write, next the
first one, setting the WREN bit and then the WR bit, after modifying the
EEADR and EEDATA files. I only got something writed on the second
location! I took my first code back and decided to make a loop,
incrementing the EEADR register and doing each time the whole thing:

       clrf temp
loop    set WREN bit
       write 55h to EECON2
       write AAh to EECON2
       set WR bit
       move temp --> EEADR
       set WR bit
       btfss temp,6
       goto loop


       The only location that has been writed is location 63! Can anybody help
me? Or is there any code I can get to make this work? Thanks in advance.

-david

1997\03\24@012133 by TONY NIXON 54964

flavicon
picon face
This is what I use to store EEPROM data.
If writes are done more than approx. 10mS apart then
the 'wtloop' can be deleted.

      bsf status,rp0  ; ram page 1
       bcf eecon1,4    ; clear write completion bit
       bsf eecon1,2    ; set WREN bit = 1
       nop
       movlw 55h       ; eeprom write
       movwf eecon2
       movlw 0xaa
       movwf eecon2
       bsf eecon1,1    ; set WR bit to initiate write
       ;
wtloop  btfss eecon1,4  ; wait until write is finished (~10mS)
       goto wtloop
       ;
       bcf eecon1,2    ; clear WREN bit
       bcf status,rp0  ; ram page 0
       incf eeadr      ; set for next eeprom address


Regards
Tony


Just when I thought I knew it all,
I learned that I didn't.

1997\03\24@012333 by Andrew Warren

face
flavicon
face
David BALDWIN <RemoveMEPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

>         clrf temp
> loop    set WREN bit
>         write 55h to EECON2
>         write AAh to EECON2
>         set WR bit
>         move temp --> EEADR
>         set WR bit
>         btfss temp,6
>         goto loop

David:

The proper sequence is:

       clear TEMP

   LOOP:

       copy TEMP to EEADR
       (optionally load EEDATA with something here)

       set WREN
       write 55 to EECON2
       write AA to EECON2
       set WR

       wait for WR to clear

       increment TEMP
       btfss TEMP,6
       goto LOOP

Your code only wrote to address 63 because you failed to wait for
the WR bit to clear (which signals the end of the internal write
cycle).

-Andy

=== Andrew Warren - spamBeGonefastfwdspamBeGonespamix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Did the information in this post help you?  Consider
=== contributing to the PICLIST Fund.  Details are at:
=== www.geocities.com/SiliconValley/2499/fund.html

1997\03\24@013410 by Andrew Warren

face
flavicon
face
   Whoops... I left out a line.

   I wrote:

{Quote hidden}

   There should be a "clear WREN" just before the "increment TEMP".

   -Andy

=== Andrew Warren - TakeThisOuTfastfwdEraseMEspamspam_OUTix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Did the information in this post help you?  Consider
=== contributing to the PICLIST Fund.  Details are at:
=== www.geocities.com/SiliconValley/2499/fund.html

1997\03\24@014242 by David BALDWIN

flavicon
face
Thanks to you, Tony and Andrew. If I understand, I have to write 55h
and AAh each time I am writing a byte! That's boring... Andrew, why do
you want me to do clear WREN?

-david

1997\03\24@025959 by Andrew Warren

face
flavicon
face
David BALDWIN <RemoveMEPICLISTspamTakeThisOuTMITVMA.MIT.EDU> wrote:

> Thanks to you, Tony and Andrew. If I understand, I have to write 55h
> and AAh each time I am writing a byte!

   David:

   Yes, that's correct... It's also a good idea to make sure that
   interrupts are disabled during the "write 55/write AA" section.

> Andrew, why do you want me to do clear WREN?

   It's not strictly necessary, but it's a good idea... While WREN
   is clear, accidental writes to the EEPROM can't occur.

   If you like, you can move the "clear WREN" to a point AFTER the
   loop, rather than leaving it inside the loop as I showed.  I'd
   probably leave it inside the loop, though, since the
   10-millisecond EEPROM write time obviates the need to save
   instruction cycles within the loop.

   -Andy

=== Andrew Warren - fastfwdEraseMEspam.....ix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Custodian of the PICLIST Fund -- For more info, see:
=== www.geocities.com/SiliconValley/2499/fund.html

1997\03\24@141700 by )

flavicon
face
If I read your message correctly, it looks as if you made the same
mistake I did when I first started using the '84s EEPROM. EEADR gets
modified every time you do a write (it works OK to increment it on read
though). All you need to do is increment a register and copy it to EEADR
before you do a write.


Frank Richterkessing
Experimental Methods Engineer
GE Appliances

EraseMEFRANK.RICHTERKESSINGspamAPPL.GE.COM



{Quote hidden}

1997\03\24@162456 by Andrew Warren

face
flavicon
face
Richterkessing, Frank H (GEA, 055132) <RemoveMEPICLISTTakeThisOuTspamspamMITVMA.MIT.EDU> wrote:

> EEADR gets modified every time you do a write

   No, it doesn't.

   -Andy

=== Andrew Warren - EraseMEfastfwdspamspamspamBeGoneix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Custodian of the PICLIST Fund -- For more info, see:
=== www.geocities.com/SiliconValley/2499/fund.html


'problems writing to EEPROM data area 16C84'
1997\11\02@060046 by erik
flavicon
picon face
Hi,

I'm not having any luck with my attempts to write to the EEPROM data area
of my 16C84. Can anyone suggest where I'm going wrong...please.

I'm using the MPASM assembler and I get the following error message
when I try and use the Option, and EECON registers (repeats for every mention
of these registers)

Warning EEDATA.ASM 77 : Argument out of range: EECON1 (0088).
                       Least significant bits used.
Warning EEDATA.ASM 79 : Argument out of range: EECON2 (0089).
                       Least significant bits used.
Warning EEDATA.ASM 266 : Argument out of range: OPTION (0081).
                       Least significant bits used.


Heres the relevant section of my code:

; Target Chip           PIC16C84
; DATE                  27/10/1997
; ITERATION             1.0
; FILE SAVED AS         eedata.asm
; CLOCK                 Xtal 32.768KHz (4x30.5uS = 120uS  cycle)
; DESCRIPTION           expt with data EEPROM
;****************************************************************
List P=16C84

INTCON  EQU     00BH
GIE     EQU     7       ;part of intcon regr Global Interrupt Enable
EEIE    EQU     6       ;part of intcon regr
TOIE    EQU     5       ;part of intcon regr Timer0 Int Enable
INTE    EQU     4       ;part of intcon regr
RBIE    EQU     3       ;part of intcon regr
TOIF    EQU     2       ;part of intcon regr Timer0 Flag
INTF    EQU     1       ;part of intcon regr
RBIF    EQU     0       ;part of intcon regr
STATUS  EQU     003H
RP0     EQU     5       ;part of status regr Register bank select bit
OPTION  EQU     081H
TEMP    EQU     010H    ;storing a counter here
W       EQU     0       ; pointer TO W REGISTER
tempa   EQU     011H
EECON1  EQU     088H
EEIF    EQU     004H    ;4 bit of EECON1
WRERR   EQU     003H    ;3 bit of EECON1
WREN    EQU     002H    ;2 bit of EECON1
WR      EQU     001H    ;1 bit of EECON1
RD      EQU     000H    ;0 bit of EECON1
EECON2  EQU     089H
EEDATA  EQU     008H
EEADR   EQU     009H


; origin vector
       ORG     00H
       GOTO    INIT
;****** interrupt vector ****************************
       ORG     04H
       GOTO    LOOP

; subroutine declarations

; write to EEPROM data section, enter with addr to write to in EEADR
; and data to be written in EEDATA. Interrupts must be disabled
; before writing
EEWR
       BCF     INTCON,GIE      ;ensure interrupts disabled
       BSF     STATUS,RP0      ;bank 1
       BSF     EECON1,WREN     ;enable a write
       MOVLW   055H            ;required sequence
       MOVWF   EECON2          ;required sequence
       MOVLW   0AAH            ;required sequence
       MOVWF   EECON2          ;required sequence
       BSF     EECON1,WR       ;required sequence, begin write
WAYT    NOP
       BTFSC   EECON1,WR       ;see if write is finished
       GOTO    WAYT            ;wait until it is
       BCF     STATUS,RP0      ;bank0
       RETURN

; read data from EEPROM data section, enter with addr to read in EEADR
; exit with data that has been read in EEDATA
EERD
       BSF     STATUS,RP0      ;bank 1
       BSF     EECON1,RD
HOLT    BTFSC   EECON1,RD
       GOTO    HOLT            ;wait for read to complete
       BCF     STATUS,RP0      ;bank0
       RETURN

; ********** main program starts here ******************************
INIT
       CLRW
       MOVWF   TEMP
       MOVWF   EEDATA
       MOVWF   EEADR

       BSF     STATUS,RP0      ;5 bank 1
       BCF     OPTION,TOCS     ;5
       BCF     OPTION,PSA      ;3 assign prescaler to timer
       BCF     OPTION,PS2      ;2
       BCF     OPTION,PS1      ;1
       BCF     OPTION,PS0      ;0
       BCF     STATUS,RP0      ;5 bank 0 again

       BCF     INTCON,TOIE     ;5 1=enable
       BCF     INTCON,EEIE     ;6 0=disable
       BCF     INTCON,INTE     ;4 0=disable
       BCF     INTCON,RBIE     ;3 0=disable
       BCF     INTCON,GIE      ;7 1=enable unmasked interrupts

LOOP
       INCF    TEMP
; write, then read something to/from EEPROM data section
       movfw   TEMP
       movwf   EEDATA  ;write data thats same as value in TEMP
       ANDLW   03FH    ;0011 1111 clear top bits
       movwf   EEADR
       call    EEWR    ;to addr thats same as value in TEMP

       clrf    EEDATA  ;clear it to see if its really read

       call    EERD    ;read into EEDATA


; display the results here...

       GOTO    LOOP

; reset vector
       ORG     01FFH
       GOTO    INIT
       END
; *************************************************************

Really grateful for any suggestions.

Cheers
--
erik

1997\11\02@164628 by Mike Keitz

picon face
>Warning EEDATA.ASM 77 : Argument out of range: EECON1 (0088).
>                        Least significant bits used.

Your code appears that it will work.  Did you try ignoring the warnings
and trying to run it in a chip or simulator?

The warnings occur because the addresses of these registers are in page
1.  You must have a very old version of the assmebler because the new
one's warning message is slightly more explanatory, something to the
effect of: "Address not in page 0.  Ensure page select bits are set."
Since you did set the page select bits, the program will work.

The best workaround to this is to write instructions that access page 1
registers like this:
       movwf   EECON2^0x80
Xoring the high bit with a 1 will clear it to 0, so the assembler won't
have to discard high bits.  And if you make a mistake like thinking the
EEDATA register is in page 1:
       movfw   EEDATA^0x80
the xor will set the high bit, and the assembler will issue a warning.

On your program, it isn't necessary to wait for a read to complete, as it
only takes 1 cycle so you can fetch the data from EEDATA immediately
after setting the RD bit.  The RD bit will never read as 1 since it
clears immediately.  In the write routine, you can allow interrupts while
waiting for the write to complete (if the ISR doesn't read the EEPROM).

1997\11\02@200942 by Felix Centeno

flavicon
face
part 0 13927 bytes
head>

This procedure is taken from the PIC16/17 Microcontroller
Data Book:
BSF      STATUS, RP0         ; BANK 1
BCF       INTCON, GIE        ; DISABLE INTS
BCF       EECON1, WREN     ;ENABLE WRITE
MOVLW         055H              ;                                ---
MOVWF   EECON2              ;                                   l
MOVLW         0AAH             ;                                   l -- this is obligatorie
MOVWF   EECON2              ;WRITE AAH               l
BSF          EECON1,WR        ;SET WR BIT              l
                                            ; BEGIN WRITE      --
BSF      INTCON, GIE         ; ENABLE INTS

----------
> From: erik <erik@DIGITS.DEMON.CO.UK>
> To: PICLIST@MITVMA.MIT.EDU
> Subject: problems writing to EEPROM data area 16C84
> Date: Domingo 2 de Noviembre de 1997 06:41 AM
>
> Hi,
>
> I'm not having any luck with my attempts to write to the EEPROM data area
> of my 16C84. Can anyone suggest where I'm going wrong...please.
>
> I'm using the MPASM assembler and I get the following error message
> when I try and use the Option, and EECON registers (repeats for every mention
> of these registers)
>
> Warning EEDATA.ASM 77 : Argument out of range: EECON1 (0088).
>                         Least significant bits used.
> Warning EEDATA.ASM 79 : Argument out of range: EECON2 (0089).
>                         Least significant bits used.
> Warning EEDATA.ASM 266 : Argument out of range: OPTION (0081).
>                         Least significant bits used.
>
>
> Heres the relevant section of my code:
>
> ; Target Chip           PIC16C84
> ; DATE                  27/10/1997
> ; ITERATION             1..0
> ; FILE SAVED AS         eedata.asm
> ; CLOCK                 Xtal 32.768KHz (4x30.5uS = 120uS  cycle)
> ; DESCRIPTION           expt with data EEPROM
> ;****************************************************************
> List P=16C84
>
> INTCON  EQU     00BH
> GIE     EQU     7       ;part of intcon regr Global Interrupt Enable
> EEIE    EQU     6       ;part of intcon regr
> TOIE    EQU     5       ;part of intcon regr Timer0 Int Enable
> INTE    EQU     4       ;part of intcon regr
> RBIE    EQU     3       ;part of intcon regr
> TOIF    EQU     2       ;part of intcon regr Timer0 Flag
> INTF    EQU     1       ;part of intcon regr
> RBIF    EQU     0       ;part of intcon regr
> STATUS  EQU     003H
> RP0     EQU     5       ;part of status regr Register bank select bit
> OPTION  EQU     081H
> TEMP    EQU     010H    ;storing a counter here
> W       EQU     0       ; pointer TO W REGISTER
> tempa   EQU     011H
> EECON1  EQU     088H
> EEIF    EQU     004H    ;4 bit of EECON1
> WRERR   EQU     003H    ;3 bit of EECON1
> WREN    EQU     002H    ;2 bit of EECON1
> WR      EQU     001H    ;1 bit of EECON1
> RD      EQU     000H    ;0 bit of EECON1
> EECON2  EQU     089H
> EEDATA  EQU     008H
> EEADR   EQU     009H
>
>
> ; origin vector
>         ORG     00H
>         GOTO    INIT
> ;****** interrupt vector ****************************
>         ORG     04H
>         GOTO    LOOP
>
> ; subroutine declarations
>
> ; write to EEPROM data section, enter with addr to write to in EEADR
> ; and data to be written in EEDATA. Interrupts must be disabled
> ; before writing
> EEWR
>         BCF     INTCON,GIE      ;ensure interrupts disabled
>         BSF     STATUS,RP0      ;bank 1
>         BSF     EECON1,WREN     ;enable a write
>         MOVLW   055H            ;required sequence
>         MOVWF   EECON2   &nbsp;      ;required sequence
>         MOVLW   0AAH            ;required sequence
>         MOVWF   EECON2          ;required sequence
>         BSF     EECON1,WR       ;required sequence, begin write
> WAYT    NOP
>         BTFSC   EECON1,WR       ;see if write is finished
>         GOTO    WAYT            ;wait until it is
>         BCF     STATUS,RP0      ;bank0
>         RETURN
>
> ; read data from EEPROM data section, enter with addr to read in EEADR
> ; exit with data that has been read in EEDATA
> EERD
>         BSF     STATUS,RP0      ;bank 1
>         BSF     EECON1,RD
> HOLT    BTFSC   EECON1,RD
>         GOTO    HOLT            ;wait for read to complete
>         BCF     STATUS,RP0      ;bank0
>         RETURN
>
> ; ********** main program starts here ******************************
> INIT
>         CLRW
>         MOVWF   TEMP
>         MOVWF   EEDATA
>         MOVWF   EEADR
>
>         BSF     STATUS,RP0      ;5 bank 1
>         BCF     OPTION,TOCS     ;5
>         BCF     OPTION,PSA      ;3 assign prescaler to timer
>         BCF     OPTION,PS2      ;2
>         BCF     OPTION,PS1      ;1
>         BCF     OPTION,PS0      ;0
>         BCF     STATUS,RP0      ;5 bank 0 again
>
>         BCF     INTCON,TOIE     ;5 1=enable
>         BCF     INTCON,EEIE     ;6 0=disable
>         BCF     INTCON,INTE     ;4 0=disable
>         BCF     INTCON,RBIE     ;3 0=disable
>         BCF     INTCON,GIE      ;7 1=enable unmasked interrupts
>
> LOOP
>         INCF    TEMP
> ; write, then read something to/from EEPROM data section
>         movfw   TEMP
>         movwf   EEDATA  ;write data thats same as value in TEMP
>         ANDLW   03FH    ;0011 1111 clear top bits
>         movwf   EEADR
>         call    EEWR    ;to addr thats same as value in TEMP
>
>         clrf    EEDATA  ;clear it to see if its really read
>
>         call    EERD    ;read into EEDATA
>
>
> ; display the results here...
>
>         GOTO    LOOP
>
> ; reset vector
>         ORG     01FFH
>         GOTO    INIT
>         END
> ; *************************************************************
>
> Really grateful for any suggestions.
>
> Cheers
> --
> erik


'Question on writing i/o'
1997\12\21@175447 by TSK196
flavicon
face
Hello Everyone,
       Merry Christmas!

       Recently I am trying to write a simple program using
17c44. I tried to use portc as my input and portd as my
output. After coming out with the program, I use the
simulator to check if my program is working?
       It turns out fine after compiling(building it)...no
errors. But when I look at the watch window, the w register
is not working. I changed the value at the input of portc and
intended to send to w then to portd. But the w is not
changing when I am stepping through my porgram. Does anyone
knows the problem?
       Below is my main program:-

LOOP    MOVPF   PORTC,0
       MOVWF   PORTD
       GOTO    LOOP
----------------------
siong
RemoveMETSK196KILLspamspamsoton.ac.uk

1997\12\21@183505 by Andrew Warren

face
flavicon
face
siong <TSK196STOPspamspamspam_OUTsoton.ac.uk> wrote:

> Recently I am trying to write a simple program using 17c44. I tried
> to use portc as my input and portd as my output.
> ....
> when I look at the watch window, the w register is not working.
> .... Does anyone knows the problem?
>
> Below is my main program:-
>
> LOOP    MOVPF   PORTC,0
>         MOVWF   PORTD
>         GOTO    LOOP

Siong:

The 17C4x's instruction set and architecture is very different
from the 16Cxx's... The "MOVPF" instruction's second operand is
a file register, not simply a "0" or "1".

To make your program work, change it as follows:

   WREG    EQU     0x0A    ;Register 0x0A is the W-Register.

   LOOP    MOVPF   PORTC,WREG
           MOVWF   PORTD
           GOTO    LOOP

-Andy

=== Andrew Warren - spamBeGonefastfwdSTOPspamspamEraseMEix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

1997\12\21@185207 by Andrew Warren

face
flavicon
face
I just wrote:

> To make your program work, change it as follows:
>
>     WREG    EQU     0x0A    ;Register 0x0A is the W-Register.
>
>     LOOP    MOVPF   PORTC,WREG
>             MOVWF   PORTD
>             GOTO    LOOP

A couple more things...

1.  You can do the same thing with one fewer instruction:

       LOOP    MOVPF   PORTC,PORTD
               GOTO    LOOP

2.  Since PORTC and PORTD are in Register Bank 1, you need to execute
   a "MOVLB 1" before entering the loop.

-Andy

=== Andrew Warren - KILLspamfastfwdspamBeGonespamix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

1997\12\21@233908 by Harold M Hallikainen

picon face
On Sun, 21 Dec 1997 22:51:05 +0000 siong <EraseMETSK196spamEraseMEsoton.ac.uk> writes:

>
>LOOP    MOVPF   PORTC,0
>        MOVWF   PORTD
>        GOTO    LOOP
>----------------------


       This is why I don't like using an F or a W in the destination of
a MOVF instruction, prefering to use movwf, movfw, and tstf.
       The problem is, I believe, (and most of my recent programming has
been on the 16c74a, but I did a little on the 17c something or another),
is that the w register is not at address 0, and it is an address that the
movpf instruction expects.  So, a movpf portc,w would not work because w
is 0 (for use in a movf instruction).  You need to say movpf portc, wreg
(where wreg is defined as the address of the w register in the ram memory
map... which it isn't in the 16 series, but is in the 17 series).

Harold

'Question on writing i/o II'
1997\12\23@090018 by tsk196

flavicon
face
part 0 2328 bytes
....."The journey of a thousand miles begins with a
small step in the right direction.".......

----------------------------
Name    : Koh Teik Siong
Email   : @spam@tsk196@spam@spamspam_OUTsoton.ac.uk
Tel     : +44 (01703) 766255
Address : Flat 4 Rm 19
         Beechmount House
         Beechmount Rd
         Bassett
         Southampton
         SO16 3JD
-----------------------------

;***********************************************************
;               DIGITAL TO ANALOG CONVERTER
;
;       This program converts the digital signal -128 to 127
;to give a output voltage of -10V to 10V. This is to control
;the voltage of the motor so that it can rotate the motor to
;the desire speed and position.
;
;***********************************************************

       list    P=17C44, r=hex



ddrc    equ     0x0110 ; I've also tried to use address 0x10
portc   equ     0x0111 ; I've also tried to use address 0x10
ddrd    equ     0x0112 ; I've also tried to use address 0x10
portd   equ     0x0113; I've also tried to use address 0x10
w       equ     0x000A
count   equ     0x0020

       ORG     0x0000
       GOTO    START

START
DELAY   macro   count
       VARIABLE I
I = 0
       WHILE I < count
I += 1
       ENDW
       ENDM

       CALL    INIT

LOOP    MOVLB   1
       movpf   portc,portd     ;GET DATA
       DELAY   100             ;O/P TO PORTD
       GOTO    LOOP            ;

INIT    MOVLB   1       ;MOVE TO BANK 1
       CLRF    portc,1 ;INIT PORTC
       setf    ddrc,1  ;PORTC IS I/P

       clrF    portd,1 ;INIT PORTD
       clrf    ddrd,1  ;PORTD IS O/P
       MOVLB   0       ;MOVE TO BANK 0
       RETURN
       END

Warning[202] C:\MPLAB\TUTOR\DAC.ASM 37 : Argument out of range.  Least
significant bits used.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 37 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 42 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 43 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 45 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 46 : Register in operand not in bank 0.
Ensure that bank bits are correct.

'Question on writing i/o II (some admendment)'
1997\12\23@091427 by tsk196

flavicon
face
part 0 2332 bytes
--
....."The journey of a thousand miles begins with a
small step in the right direction.".......

----------------------------
Name    : Koh Teik Siong
Email   : spamBeGonetsk196spamKILLspamsoton.ac.uk
Tel     : +44 (01703) 766255
Address : Flat 4 Rm 19
         Beechmount House
         Beechmount Rd
         Bassett
         Southampton
         SO16 3JD
-----------------------------

;***********************************************************
;               DIGITAL TO ANALOG CONVERTER
;
;       This program converts the digital signal -128 to 127
;to give a output voltage of -10V to 10V. This is to control
;the voltage of the motor so that it can rotate the motor to
;the desire speed and position.
;
;***********************************************************

       list    P=17C44, r=hex



ddrc    equ     0x0110 ; I've also tried to use address 0x10
portc   equ     0x0111 ; I've also tried to use address 0x11
ddrd    equ     0x0112 ; I've also tried to use address 0x12
portd   equ     0x0113 ; I've also tried to use address 0x13
w       equ     0x000A
count   equ     0x0020

       ORG     0x0000
       GOTO    START

START
DELAY   macro   count
       VARIABLE I
I = 0
       WHILE I < count
I += 1
       ENDW
       ENDM

       CALL    INIT

LOOP    MOVLB   1
       movpf   portc,portd     ;GET DATA
       DELAY   100             ;O/P TO PORTD
       GOTO    LOOP            ;

INIT    MOVLB   1       ;MOVE TO BANK 1
       CLRF    portc,1 ;INIT PORTC
       setf    ddrc,1  ;PORTC IS I/P

       clrF    portd,1 ;INIT PORTD
       clrf    ddrd,1  ;PORTD IS O/P
       MOVLB   0       ;MOVE TO BANK 0
       RETURN
       END

Warning[202] C:\MPLAB\TUTOR\DAC.ASM 37 : Argument out of range.  Least
significant bits used.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 37 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 42 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 43 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 45 : Register in operand not in bank 0.
Ensure that bank bits are correct.
Message[302] C:\MPLAB\TUTOR\DAC.ASM 46 : Register in operand not in bank 0.
Ensure that bank bits are correct.


'Oscilator calibration rewriting...'
1998\02\26@191741 by Calvin
flavicon
face
Does anybody know if the internal oscilator calibration for a 12C5XX can be
restablished (rewritten) from inside a program, and not just at StartUp?

I am having a problem when starting up the PIC, this value seem to be
corrupted sometimes. I have a timed signal coming out of one pin, and the
period of the signal varies if I switch the supply on and off fast.

I don't want to use an external reset circuit or a brown-out circuit due to
cost and limited board space.

TIA

Gabriel Gonzalez
TGO Electronics

1998\02\26@212619 by Anthony Tekatch

flavicon
face
>Does anybody know if the internal oscilator calibration for a 12C5XX can
>be restablished (rewritten) from inside a program, and not just at
>StartUp?

>I am having a problem when starting up the PIC, this value seem to be
>corrupted sometimes. I have a timed signal coming out of one pin, and the
>period of the signal varies if I switch the supply on and off fast.

I had a problem with the oscillator on a 12C508 chip at 3V and people here
suggested to me to erase the chip for a long time since the 5V programmer
will detect a blank chip before a 3V circuit thinks it's blank.


.....anthony.tekatchspam_OUTspamsympatico.ca

'Oscillator calibration rewriting...'
1998\02\26@223043 by Mauro, Chuck

flavicon
face
Yes, it can be updated anywhere in your program.  But, don't forget to
use a MOVWF OSCCAL at the very beginning of your program (@ address 0)
to establish the proper factory calibration (the data sheet explains
this).  It sounds like you are definitely experiencing a reset problem.
The brown-out circuit may be your only choice.

-Chuck Mauro

> {Original Message removed}

'Oscilator calibration rewriting...'
1998\02\27@032155 by Clyde Smith-Stubbs

flavicon
face
On Thu, Feb 26, 1998 at 05:26:33PM -0600, Calvin wrote:
> Does anybody know if the internal oscilator calibration for a 12C5XX can be
> restablished (rewritten) from inside a program, and not just at StartUp?

Sure - the oscillator calibration is a writable register - the stored value
is just a movlw instruction in the last word of the ROM. On reset the chip
starts executing from 1FF or wherever, loading the value in W, wraps around
to zero where you need a movwf to store into the OSCCAL register. In your
program code you can store whatever you like into OSCCAL at any time.


--
Clyde Smith-Stubbs               |            HI-TECH Software
Email: TakeThisOuTclyde.....spamTakeThisOuThtsoft.com          |          Phone            Fax
WWW:   http://www.htsoft.com/    | USA: (408) 490 2885  (408) 490 2885
PGP:   finger TakeThisOuTclydeKILLspamspamspamhtsoft.com   | AUS: +61 7 3354 2411 +61 7 3354 2422
---------------------------------------------------------------------------
ANSI C for the PIC! Now shipping! See http://www.htsoft.com for more info.

'Oscillator calibration rewriting...'
1998\02\27@195206 by Mike Keitz

picon face
On Thu, 26 Feb 1998 17:42:27 -0800 "Mauro, Chuck"
<.....Chuck.MaurospamRemoveMEKLA-TENCOR.COM> writes:
>Yes, it can be updated anywhere in your program.  But, don't forget to
>use a MOVWF OSCCAL at the very beginning of your program (@ address 0)
>to establish the proper factory calibration (the data sheet explains
>this).  It sounds like you are definitely experiencing a reset
>problem.

You should keep the factory value somewhere else in your program (a
logistical nightmare), and periodically do movlw <value>/movwf OSCCAL.
Second best would be to copy the factory value to RAM as well as to the
OSCCAL register at the start of the program, then periodically copy it
back to OSCCAL.  But if a glitch hits hard enough to trash the RAM, this
won't work.


_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

1998\02\27@224032 by Mauro, Chuck

flavicon
face
In this business, you have to draw the hard line occasionally on
problems like these, and unfortunately we have to make assumptions as
you pointed out below.  That's one of the engineering challenges we all
face:  making the right tradeoff when there are no great choices...

I agree with you Mike - depending on the product and the circumstances,
OSCCAL may or may not need to be refreshed periodically.  For EMC
considerations (especially in the susceptibility arena), it's things
like properly knowing when and how to refresh a critical register that
make life difficult...

Chuck Mauro

> {Original Message removed}

1998\02\27@235345 by Richard Nowak

picon face
(warning: long post -- but no cows for Gary's sake)

Some observations:

There has been some discussion recently about RAM getting corrupted I/O
registers getting messed up and that we should all include somewhere in the
firmware loop various degrees of re-initialization so the processor can get
back up on its feet after a hit.

I'm not going to tell you not to do that stuff but here are some tips I have
learned over the years to minimize the hits. I'm probably not going to state
anything that you folks don't already know, but there may be a few new
people out there that might benefit. I'm not covering everything either
because I don't know everything.

Embedded designs are not easy to troubleshoot in the first place and
sometimes you don't know if it's the hardware, the software, the firmware,
the compiler, the cable, version incompatibilities, the power supply, timing
problems, the phase of the moon etc., and repairing each bug can be an
adventure in itself. So the approach I use is to try to get it right the
first time (short cuts rarely are).

Here's a process I use:

1)  Analyze the requirements. Articulate the problem you are trying to
solve. A process I like to use is a simple one. Write a paragraph or so on
what your widget is supposed to do. Get it to a point where someone else can
read it and understand what you are trying to do without any coaching on
your part.

2)  Now take out two different colored HI-LIGHTERS and mark all the verbs
with one color and all the nouns with another. The nouns are the data. The
verbs are the processes. Collect the verbs (processes) into four streams (a)
low level (implementation dependent) input (b) high level (logical) input
(c) high level (logical) output and (d) low level (implementation dependant)
output. Collect the nouns (data) with the appropriate verbs and identify
them as either input(s) or output(s) to that process. Identify cohesive
functions by collecting similar processes within each stream.

This will help establish a functional hierarchy for your project and will
enable you to understand what needs to be done. Unfortunately it will not
reveal to you *when* things need to be done and this is the major challenge
of embedded controller designs i.e. real time systems, but if you don't know
completely what needs to be done you will quickly learn that doing the wrong
thing at the "right" time is equally useless.

3)  Take your time on the hardware design. Be conservative. You can always
eliminate things later after you get it working. Have someone else review
it. Ask her what's wrong with it. Try to visualize how your design might
fail. Incorporate mechanisms to handle the failure cases.

4)  Go directly to a PCB four layer (or more) board if you can.
Troubleshooting a rat's nest is no fun at all and you may end up spending a
lot of time learning nothing. As you acquire more experience and confidence
in your ability this won't seem so shocking.

Use the outer two layers for signal traces (most modifications occur here).
Inner layers for power and ground. Analog and digital ground eventually get
tied together someplace but try to isolate the analog circuits from the
digital ones as much as possible.

Provide layout for an addition chip (20 pin dip) just in case you need to
add a gate, a flip-flop, or other components. Provide in the layout any
by-pass caps that may be required there as well. Pay attention as to what
you are "bypassing" and where. You can't get something clean without getting
something else dirty.

5)  Pay attention to shared current paths in both the power traces and
ground traces.
If you're controlling high current loads, separate power supplies may be in
order. What you don't want is a change in load current to produce a
"recognizable" change on an input line somewhere else. A separate regulator
for the PIC circuitry could be prudent.

6)  Bypass every chip's power pin to ground using a 0.01-0.1 uF cap.

7)  Isolate the PIC as much as possible with buffers.

8)  Always use line drivers/receivers when going off board. Differential is
best. Lines should be properly terminated. If TTL, reduce pullup voltage
with diodes to limit voltage swings. Ribbon cable may not be a good choice
in faster systems.

9)  Use shielded cables. Board connectors should have a metal shell and tied
to the PCB ground plane.

10) Develop the firmware in small pieces. Ensure that each piece works
before going to the next step. Don't try to do too much at once.

11) Run the design at the slow speeds to start. When everything seems to be
working then start experimenting with fast.

12)  If possible use polling in the beginning. Interrupt driven stuff can
drive you nuts enough when that alone is not quite right.

13)  Shield the product (metal enclosure).

14) Incorporate a display in your design (leds or other) to provide visual
feedback as the PIC rips through the code.

In closing ...

I've always had a lot of respect for people who do this kind of work. It's
not easy -- it can be very frustrating, but a working design tells a lot
about the person who made it work.

Rich


At 07:34 PM 2/27/98 -0500, you wrote:
{Quote hidden}

=========================================
= Abolish the Income Tax! Fire the IRS! =
= http://www.nrst.org/                  =
=========================================


'Oscilator calibration rewriting...'
1998\03\01@104426 by Anthony Tekatch
flavicon
face
>Does anybody know if the internal oscilator calibration for a 12C5XX can
>be restablished (rewritten) from inside a program, and not just at
>StartUp?
>I am having a problem when starting up the PIC, this value seem to be
>corrupted sometimes. I have a timed signal coming out of one pin, and the
>period of the signal varies if I switch the supply on and off fast.


I had a problem with the oscillator on a 12C508 chip at 3V and people here
suggested to me to erase the chip for a long time since the 5V programmer
will detect a blank chip before a 3V circuit thinks it's blank.

spamBeGoneanthony.tekatch@spam@spamspam_OUTsympatico.ca

1998\03\01@121818 by Anthony Tekatch

flavicon
face
>Does anybody know if the internal oscilator calibration for a 12C5XX can
>be restablished (rewritten) from inside a program, and not just at
>StartUp?
>I am having a problem when starting up the PIC, this value seem to be
>corrupted sometimes. I have a timed signal coming out of one pin, and the
>period of the signal varies if I switch the supply on and off fast.


I had a problem with the oscillator on a 12C508 chip at 3V and people here
suggested to me to erase the chip for a long time since the 5V programmer
will detect a blank chip before a 3V circuit thinks it's blank.




TakeThisOuTanthony.tekatchspamspamsympatico.ca

'Oscilator calibration rewriting ..'
1998\03\01@173630 by Anthony Tekatch

flavicon
face
>Does anybody know if the internal oscilator calibration for a 12C5XX can
>be restablished (rewritten) from inside a program, and not just at
>StartUp?
>I am having a problem when starting up the PIC, this value seem to be
>corrupted sometimes. I have a timed signal coming out of one pin, and the
>period of the signal varies if I switch the supply on and off fast.

 I had a problem with the oscillator on a 12C508 chip at 3V and people
here suggested to me to erase the chip for a long time since the 5V
programmer will detect a blank chip before a 3V circuit thinks it's blank.

 anthony.tekatchEraseMEspamsympatico.ca


'Writing PIC16C84 EEPROM data memory not working.'
1998\04\19@233928 by MARVIN ANDROID
picon face
Hello,

Many thanks to everyone that answered my previous query.

My program seems to be going along quite nicely so far but now I've hit a brick
wall called DATA EEPROM MEMORY. I just cant seem to write to it!

This is what i have currently in the program and im still running it in the
simulation. The eeprom Window doesnt update with the new value. Is there
something im doing wrong here?

--------------------------------------------------
 BCF   STATUS, RP0   ;Bank 0
 ;set eeprom address
 movf address, W
 movwf EEADR

 ;write data to EEDATA
 movf data1, W
 movwf EEDATA

 BSF   STATUS, RP0   ;Bank 1
 BCF   INTCON, GIE   ;Disable INT's
 movlw 0x55
 movwf EECON2        ;Write 55h
 movlw 0xAA
 movwf EECON2        ;Write AAh
 bsf   EECON1, WR    ;Set WR bit begin write
 bsf   INTCON, GIE
--------------------------------------------------

Thanks again,

Gabes.




____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1

1998\04\20@022806 by Lauri Pirttiaho

picon face
Gabes:
{Quote hidden}

You forgot the
"BSF EECON1, WREN ; Enable Write"
line

-- Lauri

---
<a href="http://www.ee.oulu.fi/~lapi/">For more info.</a>

1998\04\20@111410 by Mike Keitz

picon face
On Sun, 19 Apr 1998 23:39:28 -0400 MARVIN ANDROID <RemoveMEm.androidEraseMEspamspam_OUTUSA.NET>
writes:
>Hello,
>
>Many thanks to everyone that answered my previous query.
>
>My program seems to be going along quite nicely so far but now I've
>hit a brick
> wall called DATA EEPROM MEMORY. I just cant seem to write to it!

The code attached looks close to right but you have to set the WREN bit
in EECON1 at some point before the "required sequence" (maybe even in
another routine, gives better protection against unintentional writes).
Simply clearing the GIE bit isn't certain to disable interrupts.  Also
it's a good idea to check/poll the WR bit before or after writing to be
sure the EEPROM isn't still busy with the last write.

Has anyone done a definite test to see if the EEPROM can be read while
it's writing?  The only place Microchip ever claimed that was in the
"Truth about AVR" and of course that wasn't all true.


_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


'problems writing internal 16c84-eeprom'
1998\10\06@144839 by Smit
flavicon
face
part 0 3570 bytes
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.71.1712.3"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000000 size=2>i'm trying to write to the internal EEPROM of
the 16c84. the problem is that i can read from it ( pre-programmed values) but i
can't write to it. i'm using te following (standard)program to read and write
the 16c84. can someone tell me what i'm doing wrong ????</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>#include &lt;16C84.h&gt;</FONT></DIV>
<DIV><FONT color=#000000 size=2>#define
Enable_EE_WR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EECON1.WREN = 1<BR>#define
Disable_EE_WR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EECON1.WREN = 0<BR>#define
EEProm_Rd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
EECON1.RD&nbsp;&nbsp; = 1<BR>#define EEProm_Writing&nbsp;&nbsp;&nbsp;&nbsp;
EECON1.WR</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2><BR>int Read_EEProm(registerw addr);<BR>void
Write_EEProm(registerx addr, registerw data);</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>void main()<BR>{<BR>&nbsp; unsigned int addr,
data;</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>&nbsp; data = 0x18;&nbsp;&nbsp; // Data to be
written/read<BR>&nbsp; addr = 0x00;&nbsp;&nbsp; // Address to write
to</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2><A
href="file://--------------">//--------------</A> EEPROM&nbsp; WRITE
----------------<BR>&nbsp; Write_EEProm(addr,data);<BR>&nbsp;
while(EEProm_Writing);&nbsp; <BR>&nbsp; <BR><A
href="file://---------------">//---------------</A> EEPROM READ
-----------------<BR>&nbsp; data = Read_EEProm(addr);&nbsp; </FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>&nbsp; TRISB = 0x00;<BR>&nbsp; PORTB =
data;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;
while(1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>}
</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>int Read_EEProm(registerw addr)<BR>{<BR>&nbsp;
EEADR = addr;<BR>&nbsp; EEProm_Rd;<BR>&nbsp;
return(EEDATA);<BR>}</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>void Write_EEProm(registerx addr, registerw
data)<BR>{<BR>&nbsp; Enable_EE_WR;<BR>&nbsp; EEDATA = data;<BR>&nbsp; EEADR =
addr;</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>#asm<BR>&nbsp; MOVLW&nbsp; 0x55<BR>&nbsp;
MOVWF&nbsp; EECON2<BR>&nbsp; MOVLW&nbsp; 0xAA<BR>&nbsp; MOVWF&nbsp;
EECON2</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>&nbsp; BSF&nbsp;
EECON2,WR<BR>#endasm<BR>}</FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV></BODY></HTML>

</x-html>

1998\10\06@201522 by Regulus Berdin

flavicon
face
> Smit wrote:
>
> i'm trying to write to the internal EEPROM of the 16c84. the problem
> is that i can read from it ( pre-programmed values) but i can't write
> to it. i'm using te following (standard)program to read and write the
> 16c84. can someone tell me what i'm doing wrong ????

Hi,

A quick check on your code, I found out that you did not set the
register banks.

> void Write_EEProm(registerx addr, registerw data)
> {
>   Enable_EE_WR;
>   EEDATA = data;
>   EEADR = addr;
> #asm

   BSF 3,5     /* Still in bank 0 due to last command, set to bank 1 */

>   MOVLW  0x55
>   MOVWF  EECON2
>   MOVLW  0xAA
>   MOVWF  EECON2
>   BSF  EECON2,WR

   BCF 3,5     /* set back to bank 0 */

> #endasm
> }

Reggie


'Writing into EEPROM on a 16C84'
1998\11\13@165014 by Adam Bryant
flavicon
face
It has been mentioned a time or two on the list that you can write into the
EEPROM area of a 16C84 during programming.  I would like to do this to
preload the EEPROM with a table of information.  How do you do this?  Do
you put an ORG to a particular location, then a series of DB's to define
the bytes?

Any pointers are greatly appreciated,
Adam

P.S., Thanks to all who replied to my "LCD help" query.  I have been able
to determine that the LCD module itself works, so therefore the problem is
in my code or in how I have it all wired up.  Shouldn't take long now to
find the root cause of the problem.

1998\11\13@180047 by Dave VanHorn

flavicon
face
Adam Bryant wrote:
>
> It has been mentioned a time or two on the list that you can write into the
> EEPROM area of a 16C84 during programming.  I would like to do this to
> preload the EEPROM with a table of information.  How do you do this?  Do
> you put an ORG to a particular location, then a series of DB's to define
> the bytes?
>

Exactly. That's how I tested my interpreter before I wrote the serial
loader code to put data into the eeprom.

1998\11\14@195117 by Mark A Moss

picon face
Try This:

       org 0x2100
       retlw           *first byte here*
       retlw           *second byte here*
         .
         .
         .
       retlw           *last byte here*

You can use several org statments if you want to jump around in the
EEPROM (program non-contiguous bytes)  I believe any opcode that passes 8
bits of data should work in place of the retlw.

Mark Moss
Amateur Radio Operator, Technician, and General Tinkerer


On Fri, 13 Nov 1998 14:39:34 -0700 Adam Bryant
<@spam@adam_bryantRemoveMEspamEraseMEEMAIL.MOORE.COM> writes:
{Quote hidden}

Mark Moss
Amateur Radio Operator, Technician, and General Tinkerer

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

1998\11\16@064228 by Caisson

flavicon
face
> Van: Adam Bryant <EraseMEadam_bryantspam@spam@EMAIL.MOORE.COM>
> Aan: @spam@PICLISTspam_OUTspam.....MITVMA.MIT.EDU
> Onderwerp: Writing into EEPROM on a 16C84
> Datum: vrijdag 13 november 1998 22:39

Hello Adam,

> It has been mentioned a time or two on the list that you can write into
the
> EEPROM area of a 16C84 during programming.  I would like to do this to
> preload the EEPROM with a table of information.  How do you do this?  Do
> you put an ORG to a particular location, then a series of DB's to define
> the bytes?

Yes and Yes.  The ORG of the EEPROM is 0x2100.

Greetz,
 Rudy Wieser

1998\11\16@113020 by Adam Bryant

flavicon
face
Interesting that you should mention that, because that is exactly what I am
trying to do as well.  I have a small 2 wheeled robot (uses modified RC
servos for motors), and I am writing a LOGO interpreter on a 16C/F84 so my
son can learn a little bit about programming by sending LOGO commands to an
autonomous robot.  Initially the LOGO commands will be stored in the
internal EEPROM, but eventually I will include an IR receiver on the robot
that will receive the LOGO program from a PC equipped with an IR
transmitter and store the LOGO commands in an external (to the PIC) EEPROM.

I will post details when I get it working.
Adam





spamBeGonedvanhornEraseMEspamCEDAR.NET on 11/13/98 03:56:52 PM

Please respond to PICLISTspamBeGonespamMITVMA.MIT.EDU

To:   RemoveMEPICLIST@spam@spamspamBeGoneMITVMA.MIT.EDU
cc:    (bcc: Adam Bryant/PEAK/MOORE)
Subject:  Re: Writing into EEPROM on a 16C84




Adam Bryant wrote:
>
> It has been mentioned a time or two on the list that you can write into
the
> EEPROM area of a 16C84 during programming.  I would like to do this to
> preload the EEPROM with a table of information.  How do you do this?  Do
> you put an ORG to a particular location, then a series of DB's to define
> the bytes?
>
Exactly. That's how I tested my interpreter before I wrote the serial
loader code to put data into the eeprom.

1998\11\18@225952 by netquake

flavicon
face
I feel confortable using de. But that's rather personal.
DE - Declare EEPROM Data Byte

Syntax
[<label>]               de              <expr> [, <expr>, ..., <expr>]

Description
Reserve memory words with 8-bit data.  Each <expr> must evaluate to an
8-bit value.  The upper bits of the program word are zeroes.  Each
character in a string is stored in a separate word.


----------
{Quote hidden}

Do
> > you put an ORG to a particular location, then a series of DB's to
define
> > the bytes?
>
> Yes and Yes.  The ORG of the EEPROM is 0x2100.
>
> Greetz,
>   Rudy Wieser
>

1998\11\19@063426 by Caisson

flavicon
face
> Van: netQ <netquakeEraseMEspam@spam@innocent.com>
> Aan: RemoveMEPICLISTspamspamBeGoneMITVMA.MIT.EDU
> Onderwerp: Re: Writing into EEPROM on a 16C84
> Datum: woensdag 18 november 1998 7:38

<Snip>

{Quote hidden}

Your'e right, that's what I'm using too.  Just confused 80x86 assembly with
PIC assembly ...

Greetz,
 Rudy Wieser

'writing to portB'
1998\11\28@090624 by marbel

picon face
part 0 551 bytes content-type:application/octet-stream; x-mac-type="5041736D"; x-mac-creator="4D"i have bit one and two set in a certain state now i want to write to bit 3,4
without affecting the other bits how to doe this without completely
re designing the code


look at atached code


Marcel
spamBeGonemarbelKILLspamspam@spam@xs4all.nl
Amsterdam
Content-Type: application/octet-stream; x-mac-type="5041736D"; x-mac-creator="4D"
504943"; name="Untitled1"
Content-Description: MacPIC 68K Document
Content-Disposition: attachment; filename="Untitled1"

Attachment converted: wonderland:Untitled1 (PAsm/MjýÛ) (0001F813)

1998\11\29@030248 by engelec

picon face
use  ANDLW

Andre Abelian


M van der Bilt wrote:

{Quote hidden}

--------------------------------------------
>
>                       Name: Untitled1
>    Untitled1          Type: unspecified type (application/octet-stream)
>                   Encoding: base64
>                Description: MacPIC 68K Document


'Pens for Writing OSCCAL Values on JW Parts'
1998\12\19@004742 by Michael J. Ghormley
flavicon
face
I have received a couple of private E-mails asking for particulars after
mentioning this pen.  So I am thinking maybe more people would like to know
more about this.

I have been writing the factory OSCCAL value read from windowed 12C509/JW's
onto the bottom of the chips.  I have been using the Speedball "Painters"
Metalic Marker to do this.  It is a fine-point pen that writes in paint
rather than ink.  I use the gold color (#7328).  I find them in craft and
stationery stores for ~$3US.

It takes a steady hand, but is very readable and pretty permanent --
especially being protected by the chip's pins.

Michael

*************************************************************************
When the way of the Tao is forgotten, kindness and ethics must be taught.
Men must learn to pretend to be wise and good.  --  Lao Tzu
*************************************************************************

1998\12\19@091929 by wwl

picon face
On Sat, 19 Dec 1998 09:36:43 -0800, you wrote:

>I have received a couple of private E-mails asking for particulars after
>mentioning this pen.  So I am thinking maybe more people would like to know
>more about this.
>
>I have been writing the factory OSCCAL value read from windowed 12C509/JW's
>onto the bottom of the chips.  I have been using the Speedball "Painters"
>Metalic Marker to do this.  It is a fine-point pen that writes in paint
>rather than ink.  I use the gold color (#7328).  I find them in craft and
>stationery stores for ~$3US.
>
>It takes a steady hand, but is very readable and pretty permanent --
>especially being protected by the chip's pins.
Remember that pencils write pretty well on ceramic!

1998\12\19@100233 by Michael J. Ghormley

flavicon
face
Mike Harrison wrote:

> Remember that pencils write pretty well on ceramic!

And rub off just as well!  The chips that I have are pretty dark on the
bottom and you would have to rely on the reflectivness of the graphite to
read it, methinks.

IMO this number is too important to not use some more permanent means of
saving it.  Either my idea or the Staedtler-Mars Lumocolor #313 suggested
by Lawrence Lyle and others is the way to go.  The pins of the DIP
packages will give you protection from the occasional finger, but I would
worry that placing it in conductive foam a few times might rub it off.

Of course, your mileage may vary.

Michael

*************************************************************************When th
e way of the Tao is forgotten, kindness and ethics must be taught.
Men must learn to pretend to be wise and good.  --  Lao Tzu
*************************************************************************

1998\12\19@110103 by Reginald Neale

flavicon
face
>Mike Harrison wrote:
>
>> Remember that pencils write pretty well on ceramic!
>
>And rub off just as well!  The chips that I have are pretty dark on the
>bottom and you would have to rely on the reflectivness of the graphite to
>read it, methinks.
>
>IMO this number is too important to not use some more permanent means of
>saving it.  Either my idea or the Staedtler-Mars Lumocolor #313 suggested
>by Lawrence Lyle and others is the way to go.  The pins of the DIP
>packages will give you protection from the occasional finger, but I would
>worry that placing it in conductive foam a few times might rub it off.
>
>Of course, your mileage may vary.

The Sanford 'Sharpie' is a permanent-ink marker pen that's available in a
fine-point version. You can get it at Office Max or Staples.

Reg Neale

1998\12\20@111804 by Peter L. Peres

picon face
On Sat, 19 Dec 1998, Mike Harrison wrote:

> Remember that pencils write pretty well on ceramic!

Yes ! That is a golden idea. I suppose that one can help a little with
diamond paper before writing. Graphite withstands most washing and spray
liquids, but not rubbing.

I was thinking along the lines of a capilar dunked in HF + indicator (red)
to write with on ceramic and glass packages. The HF will etch and the
indicator will remain in the etched out area, hopefully. I think that
someone is selling glass markers that work along the same lines (perhaps
not HF). I'll ask the chemist this week.

Beware: HF is an evil substance. Observe precautions when using.

I'd like to thank everyone who has contributed to this thread so far, I've
actually tried out quite a few 'permanent' markers, with the result, that
the alcohool and other undetermined solvents in a certain laquer that I
apply after assembly gets at the writing even underneath, turning it into
illegible splotches of ink.

My method of scratching the numbers into the brass bezel with a steel
needle was the best imho, until the pencil idea that is.

Actually imho Microchip could save us the labor by programming the
packaging inscriptor machine to put the relevant constant at the end of
the serial number f.ex. imho

Peter

1998\12\20@234316 by Shahid Sheikh

picon face
Since so many people have replied to this, I thought I do so as well and
add to the noise. I just write it on a sticker with a fine tip pen and
stick it to the underside of the chip.

Shahid

1998\12\21@145133 by John Payson

flavicon
face
|I have been writing the factory OSCCAL value read from windowed 12C509/JW's
|onto the bottom of the chips.  I have been using the Speedball "Painters"
|Metalic Marker to do this.  It is a fine-point pen that writes in paint
|rather than ink.  I use the gold color (#7328).  I find them in craft and
|stationery stores for ~$3US.

What about having a programmer automatically determine the best
value to use whenever an EPROM device is programmed.  It would
only cost 7 words of code space from $1F8 to $1FE or $3F8 to
$3FE to burn the test program, and it would then eliminate the
need to worry about the calibration constant.  I've posted this
idea before but not had time to implement it.  Has anyone else
tried it?

1998\12\21@202354 by Jim Robertson

flavicon
face
At 13:52 21/12/98 -0600, you wrote:
>|I have been writing the factory OSCCAL value read from windowed 12C509/JW's
>|onto the bottom of the chips.  I have been using the Speedball "Painters"
>|Metalic Marker to do this.  It is a fine-point pen that writes in paint
>|rather than ink.  I use the gold color (#7328).  I find them in craft and
>|stationery stores for ~$3US.
>
>What about having a programmer automatically determine the best
>value to use whenever an EPROM device is programmed.  It would
>only cost 7 words of code space from $1F8 to $1FE or $3F8 to
>$3FE to burn the test program, and it would then eliminate the
>need to worry about the calibration constant.  I've posted this
>idea before but not had time to implement it.  Has anyone else
>tried it?


This is how I solve the OSCCAL problem.

1) Scratch each part with a unique, sequentual letter, A, B, C
2) The part is now  "virtual" with the name of 12C508__A, 12C508__B etc.
3) Put it in my programmer.
4) Click on the "CAL"  button
5) Click on the "AVAILABLE" radio button (Up to 10 or 12 devices supported)
6) Click on the "READ CAL" button. CAL is now read.
7) Click on "SAVE CAL and EXIT" CAL is now written to file.
8) Use virtual parts in sequence A, B, C -OR-  in reverse order.
9) Mark any gaps in sequence as "unavailable." Nice feature.
10) Use "AUTO CAL" and let my programmer insert CAL Automatically everytime!
11) Save my sweat for code writing and not trivial stuff.
12) Wonder why more people don't use my WinTM4 software.

Jim



--------------------------------------------------------
Jim Robertson
Email: spamBeGonenewfound@spam@spampipeline.com.au

http://www.pipeline.com.au/users/newfound
--------------------------------------------------------

1998\12\21@220618 by James Cameron

flavicon
face
Jim Robertson wrote:
> 12) Wonder why more people don't use my WinTM4 software.

Does it run on Linux?  ;-)
No?  Oh, that'd be why I don't use it then.

I've found some programming code uses the PC system clock for timing.  A
call to wait for one hundred microseconds may end up waiting for between
101 and 200 microseconds.   Certain addresses will have been given a
pulse that is longer than what the programming specification calls for.

Does anybody know what impact this may have on programming the 12C509-JW
parts?

--
James Cameron                                      (RemoveMEcameronEraseMEspamKILLspamstl.dec.com)

OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH,
COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers,
Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control,
Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband.

"Specialisation is for insects." -- Robert Heinlein.

1998\12\21@221252 by Craig R. Autio

flavicon
face
You wrote:
>
>I have been writing the factory OSCCAL value read from windowed 12C509/JW's
>onto the bottom of the chips.  I have been using the Speedball "Painters"
>Metalic Marker to do this.  It is a fine-point pen that writes in paint
>rather than ink.  I use the gold color (#7328).  I find them in craft and
>stationery stores for ~$3US.
>


We have been using the Uni-paint pens.  They are oil base paint markers
available from Boise Cascade, the office supply people.  For production
marking, we use an ink pad and a rubber stamp.  The ink is from Markem
Corporation, Keene NH., 1-800-322-0116.

Craig R. Autio
spamBeGonecautiospam_OUTspamRemoveMEshaysnet.com

1998\12\22@163231 by Peter L. Peres

picon face
On Tue, 22 Dec 1998, James Cameron wrote:

> Does anybody know what impact this may have on programming the 12C509-JW
> parts?

No, but I know from experience that it has none on several 16C54JWs and a
small score of 16C54XT-04 OTPs.

There is no warranty of course, but the spec sheet gives a range between
10 and 1000 usec for the programming pulse for normal locations and
between 1000 and 10,000 for the fuses on the '54 ?

Please check these numbers, they are off of my head now.

I'd like to add that I wrote a programmer driver that tabulated the no. of
pulses required to program each location and the number was invariably of
4 for all locations, even after several tens of erasures on the JW parts,
for 100 usec pulses. This is from the time when the programming specs
specified 3 x over-programming.

Peter

1998\12\22@171127 by Peter L. Peres

picon face
On Mon, 21 Dec 1998, John Payson wrote:

> What about having a programmer automatically determine the best
> value to use whenever an EPROM device is programmed.  It would
> only cost 7 words of code space from $1F8 to $1FE or $3F8 to
> $3FE to burn the test program, and it would then eliminate the
> need to worry about the calibration constant.  I've posted this
> idea before but not had time to implement it.  Has anyone else
> tried it?

I haven't and I'm interested. Could you explain a little bit ? Does the
programmer have to be able to turn on the chip in normal operation mode
and read out a pin ?

Peter

1998\12\23@163532 by John Payson

flavicon
face
> What about having a programmer automatically determine the best
> value to use whenever an EPROM device is programmed.  It would
> only cost 7 words of code space from $1F8 to $1FE or $3F8 to
> $3FE to burn the test program, and it would then eliminate the
> need to worry about the calibration constant.  I've posted this
> idea before but not had time to implement it.  Has anyone else
> tried it?

|I haven't and I'm interested. Could you explain a little bit ? Does the
|programmer have to be able to turn on the chip in normal operation mode
|and read out a pin ?

You'd need to be able to start/run the PIC normally.  Note that
since you'd be testing the calibration before burning the fuse
to disable /MClr, you could use /MClr L->VPP to re-enter program
mode.

The code I'd recommend using would be this [at $1F9 or $3F9]

               movlw   127
               xorlw   255
               movwf   5
               movlw   254             ; Bit 0 is only output
               tris    PORTB
               comf    PORTB

Running this code will cause the PORTB.0 pin to flip every 512
or 1024 cycles.  Start with the code as above, and the modify it
per the following algorithm:

               if oscillator was too fast, blow bit 7 of the xorlw
               blow bit 6 of the first movlw instruction
               if oscillator was too fast, blow bit 6 of the xorlw
               blow bit 5 of the first movlw instruction
               if oscillator was too fast, blow bit 5 of the xorlw
               blow bit 4 of the first movlw instruction
               if oscillator was too fast, blow bit 4 of the xorlw

; Note that for the original '508's you may stop here.  If you
; want to allow for an 8-bit calibration constant, you may keep
; going...

               blow bit 3 of the first movlw instruction
               if oscillator was too fast, blow bit 3 of the xorlw
               blow bit 2 of the first movlw instruction
               if oscillator was too fast, blow bit 2 of the xorlw
               blow bit 1 of the first movlw instruction
               if oscillator was too fast, blow bit 1 of the xorlw
               blow bit 0 of the first movlw instruction
               if oscillator was too fast, blow bit 0 of the xorlw

Once that's accomplished, determine which of the last two speeds
was the best; use that speed as the calibration value.

Cute, eh?

1998\12\24@120448 by Peter L. Peres

picon face
On Wed, 23 Dec 1998, John Payson wrote:

> Cute, eh?

Yes ! Nice. imho it would be nice if Mchip could pre-program 508's and
509s with a simple program that toggles an IO bit like this when the
device is virgin (OTPs). Then the programmer could determine the real
frequency for each device before burning the code, and could call a
patcher that adjusts code loops in the object file to adjust for the exact
real speed, instead of trimming the oscillator. Ah, I'm just dreaming ;)

Alternatively, have a FLASH location hold the trim value and allow the PIC
to correct itself at run-time in a test jig using users' software, after
burning. This obviates the need for factory-inserted trim values (a
missing inverter in Silicon can make the 0xFF factory line FLASH trim
location a 0x80 for a sane start value). Ah, I'm just dreaming some more
;) ;)

Peter


'Writing a string of chars to LCD'
1999\04\19@184242 by hno
flavicon
face
Hi everybody.

I'm new here, so please excuse me, if this is not done the right way.
I have a problem with writing a string of chars to a LCD display.
The code is written in C, and is pretty straight forward. I use the MPLABC
v. 1.21 compiler.

I have placed the functions here, and I really hope that some of you can
help me, as this litlle problem is drinving me crazy.
The funny thing is that when I place a couple of putchar's after eachother
it works just fine. And when I use putstring, and the string is placed in
RAM space it also works fine.


const char String[] = "I am a string";  // I want the string placed in ROM

void putc(unsigned char chr)            // Used in the putchar function
{
 unsigned char bit;

 PORTA.ClockOut = 0;           /* Clock low */
 PORTA.DataOut = 1;            /* Set SR bit -> 4094 */
 PORTA.ClockOut = 1;           /* Clock high */
 for (bit=8; bit>0; bit--)
   {
     if (chr & 0x80)
       {
         PORTA.DataOut = 1;    /* Set data bit -> 4094 */
       }
     else
       {
         PORTA.DataOut = 0;    /* Reset data bit -> 4094 */
       }
     PORTA.ClockOut = 0;       /* Clock low */
     PORTA.ClockOut = 1;       /* Clock high */
     chr <<= 1;                /* Shift left byte */
   }
   PORTA.StrobeOut = 1;        /* Display Strobe high */
   PORTA.StrobeOut = 0;        /* Display Strobe low */
   xpos += 1;
}

void endline(void)              // Used in the putchar function
{
 while (xpos < 16)
   {
     putc(' ');                /* Erase character */
   }
 if (ypos == 0)                /* If first line */
   {
     ypos = 1;
     putctrl(0xC0);            /* Second line, first pos. */
   }
 else if (ypos == 1)           /* If second line */
   {
     ypos = 2;
     putctrl(0x90);            /* Third line, first pos. */
   }
 else if (ypos == 2)           /* If third line */
   {
     ypos = 3;
     putctrl(0xD0);            /* Fourth line, first pos. */
   }
 else
   {                             /* Else */
     ypos = 0;
     putctrl(0x80);            /* First line First pos */
   }
 xpos = 0;
}

void putchar(unsigned char chr)         // Used in the putstring function
{
 unsigned char bit;

 if (xpos == 16)               /* Check if last pos. on line */
   {
     endline();                /* If last pos. then go to new line */
   }
 putc(chr);
}

void putstring(char far *pstr)          // This function does not work
{
 unsigned char temp;

 while (*pstr != 0)
   {
     temp = *pstr;
     *pstr++;
     putchar(temp);
   }
}


Thanking you in advance

Henrik Nowak
Electronics engineer student
Email.: .....hnospamRemoveMEpost3.tele.dk

'Writing string of chars to LCD......again'
1999\04\20@163252 by hno

flavicon
face
Hi everybody.

First, I would like to thank Sean Breheny and Adriano De Minicis for correcting
my SW bug.
But I still have a problem when I want to write an entire string of chars to the
display.
Please note that the string is placed i ROM, using a const char assignment.
When I try to write on single character it works fine, but when I use my putstri
ng() function, the program crashes, and resets.

I wonder if it is a compiler error, since I have checked everything, and I know
that MPLABC v. 1.21 has a few problems.

I really hope that any of you guys out there can help me on this problem.

Thanks in advance

Henrik Nowak
Electrical engineering student
email.: hnospam@spam@post3.tele.dk

'Trouble with writing char to LCD display'
1999\04\22@121552 by hno

flavicon
face
Hi everybody

Please excuse me for reposting this, but I am not if my earlier message
made it to the list.

I have a big problem, which I hope that some of you would like to help me
solve. I use a PIC16F84 to write to a LCD display, but I'm having trouble
writing an entire string of chars to the display.
I do it like this.:

const char String[] "I am a string";

my putstring() looks like this.:

void putstring(char far *pstr)
{
 unsigned char temp;

 while (*pstr != 0)
   {
     temp = *pstr;
     pstr++;
     putchar(temp);
   }
}

The putchar works just fine if I only write out a single char, but when i
try this, the pic writes out the string, and then resets, it does not get
any further in my program. I use MPLABC v. 1.21. I have had this problem
for a long time, and can't figure out what is wrong. So if any of you
outthere would help me, I would gladly appreciate it.

Thanking you in advance

Henrik Nowak
Electronics Engineer student
EraseMEhnoRemoveMEspamSTOPspampost3.tele.dk

'Question: Writing chars to LCD'
1999\04\30@202256 by hno

flavicon
face
Hi Piclisters

I have a PIC16F84 hooked up with a 2 line LCD Display, and it is working
just fine. But I have a small problem. I can't write out an entire string
to the display. When I try to do it, the pic resets. The string is an array
placed in ROM. The putstring function is, in fact, only a loop which puts
out a char on at the time, and test for 0. When I just want to put out a
single char it is working fine. Therefore I wonder if it could be some sort
of compilerbug (MPLABC 1.21). I really hope that someone can help me, as
this is a problem for me. I am quite new to picprogramming, so any help
would be gladly appreciated. I can send the source, if anyone is willing to
help me.

Thanks in advance

Henrik Nowak
Electronics engineer student
RemoveMEhnoKILLspamspamTakeThisOuTpost3.tele.dk


'Question: Writing chars to LCD'
1999\05\03@020943 by Dr. Imre Bartfai
flavicon
face
Hi,
apply the ClrWdt instruction after sending every character.
I hope this helps.
Imre


On Sat, 1 May 1999, Henrik Nowak wrote:

{Quote hidden}

'code protection and program flash writing on 16F87'
1999\05\26@020722 by Eric Smith

flavicon
face
>   If you could add code to a protected chip, you could write in a "read"
> routine to send it all back *out* again via the UART.  I think that's
> the reason.

No, because only code already in the part could write to the flash.  That
code might include a code downloader, but it could decrypt the downloaded
code or check a digital signature, so that an attacker does not no how to
construct a loadable image that would dump the ROM.

What they should have done is to have two *separate* bits that disable
verification (the traditional code protection) and flash writing.


'Writing data to PIC16F84 from PC'
1999\09\22@084148 by Glenn Pure
picon face
I'm seeking some help to solve a problem with a gadget I'm making.

This is a long and detailed question so don't bother now if you haven't got
15 minutes to spare.

First, here's what I'm doing...

1. I've built a 'controller' using a PIC16F84 to keep a real time clock and
switch relays on and off according to program information stored in the
PIC, in the 64 bytes of EEPROM data memory. This part is working fine

2. I need to update the program data in the EEPROM data memory from time to
time. This will be done through an interface with the parallel port on a
standard IBM PC running Windows 3.x or later.

I'm writing the PC Windows application with Borland C. I can read the
contents of my PIC EEPROM data memory without problem. I can also write
fresh data to this memory with my software, but the latter process is
unreliable. Sometimes it will write 64 bytes without a glitch, other times
it will stop writing after an unpredictable number of bytes (from 1 to
63!). I can't fathom why. About 50% of the write operations occur without
problem and the other 50% fail at some point.

I'll describe the logic behind the software in my PIC and the Windows
software with which it interacts in the hope someone might be able to give
me clues about why my writes are unreliable. I'm sure lots of other people
have done this sort of thing lots of other times before.

The PIC is triggered to enter read or write mode with the RB0/INT pin
(which is connected to D4 of the parallel port). As soon as the interupt is
detected, the remaining software routines for reading and writing operate
entirely on a 'polled' rather than interupt basis.

If a write to the PIC is to occur, I send RB6 on the PIC low (connected to
D0 of the parallel port). Next step is a 'handshake' so the PC can be
convinced it is connected to the controller. This handshake is simply 50
cycles of the following:

* the PC sends RB1 high (configured as an input on the PIC, of course). The
PIC loops for a few milliseconds waiting for this to happen
* once the PIC sees RB1 go high, it sends RB2 low (configured as an
output). The PC watches the relevant port pin to which RB2 is connected
until it sees this then it sends RB1 low.
* when the PIC sees RB1 go low, it sends RB2 high and the whole cycle
repeats again.

For added robustness, I make the PIC send out the two bytes "O" then "K"
serially on RB2 (using the read process I have written).

The above handshake appears to occur very reliably and errors are very rare.

I won't bother explaining the read process as this is occurring reliably
(it uses a variation on the handshake to clock data into the PC serially
from RB2 on the PIC).

The PC to PIC write process is also similar to the read except the data is
clocked serially from PC to PIC as follows:

* After the handshake process succeeds, the PIC is signalled to go into the
write routine as RB6 is sent low by the PC. After this, RB6 is ignored.

* Each byte is read in one at a time and written to the EEPROM memory in
the PIC straight after it is received. That is, a byte is received, then
written, then the next received then written (and so until until 64 bytes
received). The PIC will exit from this process if the routine for receiving
data from the PC times out while waiting for the correct signals from the
PC for receipt of bits (see below for details).

* As noted above, a byte is sent to the PIC serially and the following
loops eight times, once for each bit. First, the PIC sends RB2 high to
signal it is ready for a bit. The PC sends RB3 high when the output bit is
ready (the bit is output to RB1). Once the PIC sees RB3 go high, it
immediately sends RB2 low and then reads the bit. It then waits for RB3 to
go low before starting the loop again for the next bit. The PIC and the PIC
both loop for a set maximum amount of time (a few milliseconds) while
waiting for the next signal from one another. If either of these loops
times out, and error occurs and the routines are exited.

* Once the PIC has received a byte, it is written and the PIC signals the
write is completed by sends RA0 high (normally held low by the PC). The PC
loops for up to 20 milliseconds until it sees this. If the PC times out at
this point, the routine aborts.

Through diagnostics I have built into the software, I can determine that
the write failures are always occuring as a failure by the PIC to receive
the first bit after a write operation is completed. Specifically, the PC
fails to see RB2 go low.

I strongly suspect a timing problem but have not seen *any* improvement by
changing the length of time allowed for polling of signals. I can increase
this by 5 or ten fold and see no improvement in reliability.

I have tried lots of other things to try and solve this by adding software
debouncing of signals, changing the pins used for signalling (and months
worth of other things) without any improvement. I have just about given up
trying to solve this. In fact, I have copped out by simply changing the
software so I write until a byte fails, then pick up at this byte next
time. By repeating this up to five times, I can get the data written to the
PIC. But I hate fixes like this and would really like to know what I might
be doing wrong.

Glenn

1999\09\23@035026 by Dubois Michel

flavicon
face
First, sorry for my English......

I have se same kind of problem, using Visual Basic 3.
I found a partial explanation: my printer driver (a Canon LBP660) sends
something on the parallel port every minute.....
I disabled it from the WIN.INI


Glenn Pure a Žcrit :

{Quote hidden}

1999\09\23@035442 by Dr. Imre Bartfai

flavicon
face
Hi,

did you time the write operation to the PIC EEPROM? One must wait until
the writing is completed.

Regards,
Imre

On Wed, 22 Sep 1999, Glenn Pure wrote:

{Quote hidden}

1999\09\23@045650 by John Bes

flavicon
face
On woensdag 22 september 1999 13:25, Glenn Pure
[SMTP:RemoveMEGlenn.Purespam_OUTspamPCUG.ORG.AU] wrote:
> I'm seeking some help to solve a problem with a gadget I'm making.
>
> This is a long and detailed question so don't bother now if you haven't
got
> 15 minutes to spare.
>
><SNIP>

I had a similar problem with the eeprom. It took me some time, but finally
found out that I was switching memory banks, but when a certain event
occured I didn't switch back. This resulted in me updating EEADR and EEDATA,
but in the wrong bank. It didn't hang, though it looked like it. What it was
doing was: repeatedly writing the previous EEDATA value to the previous
EEADR (it wasn't updated). It seemed the pic wasn't going anywhere, but it
just was repeating itself all the time.

Hope this helps,
John

1999\09\24@064326 by felix centeno

flavicon
face
try with a second stop bit (or 2 stops bits), I had have some problems with
the serial port and this solve it


-----Mensaje original-----
De: Glenn Pure <Glenn.PurespamspamPCUG.ORG.AU>
Para: spam_OUTfcentenospam_OUTspamspam_OUTIAMNET.COM <fcentenospam_OUTspamIAMNET.COM>
Fecha: Miircoles, 22 de Septiembre de 1999 08:55 a.m.
Asunto: Writing data to PIC16F84 from PC


{Quote hidden}

rare.
{Quote hidden}

1999\09\24@081205 by Glenn Pure

picon face
Thanks. I don't think this is my problem as the error is random - but I'll
take a look. I still suspect a timing problem of some sort, possibly due to
Windows 95b (under which I am doing the testing) interupting the exchange
with the PIC. However, I haven't yet cracked where in my code to fix this
(if in fact it is the problem).

Cheers
Glenn

At 10:49 23/09/99 +0200, you wrote:
{Quote hidden}


'Propic2 writing error in some F84's'
1999\11\17@121728 by Ercan Duran
flavicon
face
part 0 1473 bytes
<META content=text/html;charset=iso-8859-9 http-equiv=Content-Type>
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000000 size=2>Hello.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>I builded Propic2 programmer schematic it's date
3 September 1999 and I'm using V2.97C.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>But it's not writing to some of the 16F84 chips,
producing <STRONG>&quot;Writing Error in mem ...&quot;.</STRONG></FONT></DIV>
<DIV><FONT color=#000000 size=2><STRONG></STRONG></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>I programmed 25 chips and two of them has
errors.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>When I test old program and programmer there is
no problem. Old one is writing all of them.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>Where is the
problem...?</FONT></DIV></BODY></HTML>

</x-html>


'Overwriting previous address'
2000\03\15@111845 by Ismael M. Khangane
flavicon
face
Hello Picers:
Whenever I compile my file I receive these errors! How can I correct
them?

Building ERGOAS~1.HEX...

Compiling ERGOAS~1.ASM:
Command line: "D:\MPLAB_~1\MPASMWIN.EXE /aINHX32 /e+ /l+ /x- /w0 /c+
/rhex /p17C756 /q D:\MPLAB_~1\ERGOAS~1.ASM"
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 73 : Overwriting previous address
contents (0000)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 73 : Overwriting previous address
contents (0000)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 81 : Overwriting previous address
contents (0008)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 81 : Overwriting previous address
contents (0008)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 85 : Overwriting previous address
contents (0010)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 85 : Overwriting previous address
contents (0010)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 89 : Overwriting previous address
contents (0018)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 89 : Overwriting previous address
contents (0018)
Error[113]   D:\MPLAB_~1\ERGOAS~1.ASM 362 : Symbol not previously
defined (Exit_PeriInt)

MPLAB is unable to find output file "ERGOAS~1.HEX".

Build failed.

--
------------------------------------------------------------------
Ismael M. Khangane, Specialist in Robotics. Automatic Control & Systems
( Bsc in Eng.)
Instituto de Automatica Industrial IAI-CSIC
Madrid, Spain.
Tel: (34) 91 871 1900
Fax: (34) 91 871 7050
E-mail: imkespspamBeGonespam.....excite.com ; KILLspamismaelmspam.....iai.csic.es
------------------------------------------------------------------

2000\03\15@112515 by PDRUNEN

picon face
I think I get this when ever code from page0 starts to overlap onto page1.

You may have to move some stuff in one page to another page in the PIC memory.

Paul

In a message dated 3/15/00 11:18:42 AM EST, spam_OUTismaelmspamKILLspamIAI.CSIC.ES writes:

<< Hello Picers:
Whenever I compile my file I receive these errors! How can I correct
them?

Building ERGOAS~1.HEX...

Compiling ERGOAS~1.ASM:
Command line: "D:\MPLAB_~1\MPASMWIN.EXE /aINHX32 /e+ /l+ /x- /w0 /c+
/rhex /p17C756 /q D:\MPLAB_~1\ERGOAS~1.ASM"
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 73 : Overwriting previous address
contents (0000)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 73 : Overwriting previous address
contents (0000)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 81 : Overwriting previous address
contents (0008)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 81 : Overwriting previous address
contents (0008)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 85 : Overwriting previous address
contents (0010)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 85 : Overwriting previous address
contents (0010)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 89 : Overwriting previous address
contents (0018)
Error[118]   D:\MPLAB_~1\ERGOAS~1.ASM 89 : Overwriting previous address
contents (0018)
Error[113]   D:\MPLAB_~1\ERGOAS~1.ASM 362 : Symbol not previously
defined (Exit_PeriInt)

MPLAB is unable to find output file "ERGOAS~1.HEX".

Build failed.
 >>

2000\03\15@193035 by Jim Robertson

flavicon
face
At 05:18 PM 3/15/00 +0100, you wrote:

There is a known bug in one version of MPASM that causes the config word
to be written to the wrong address. Maybe this is the problem . I would
suggest
that you download the latest MPLAB/MPASM and try again.

Jim

{Quote hidden}

Regards,

Jim Robertson
NEWFOUND ELECTRONICS
________________________________________
Email: newfoundspamspampipeline.com.au
http://www.new-elect.com
MPLAB compatible PIC programmers.
________________________________________

2000\03\16@070317 by Andrew Warren

face
flavicon
face
Ismael M. Khangane <RemoveMEPICLISTspamBeGonespamRemoveMEMITVMA.MIT.EDU> wrote:

{Quote hidden}

Ismael:

If you examine your source code, I'm sure you'll find that you've
ORGed your main program at address 0, then tried to place GOTO
statements at the interrupt vectors (addresses 0, 8, 10, and 18).

Move the start of your main program past those vectors (by ORGing it
at 20 or something); that'll fix your problem.

-Andy


=== Andrew Warren - KILLspamfastfwdspamBeGonespamix.netcom.com
=== Fast Forward Engineering - San Diego, California
=== http://www.geocities.com/SiliconValley/2499


'Writing to Flash'
2000\05\30@081643 by Andy Stubbins
flavicon
picon face
Hi guys,
This probably sounds very trivial but I am having trouble writing to flash in the 16f876, I have followed the example to the letter in the data book and no matter what I try the routine does not appear to have any affect. I can step through the routine using the ICEPIC emulator and everything appears to be correct, however if I stop the routine after the required sequence the status of the EECON1 reg is not affected. This would suggest to me that a delay is required at this point but is not suggested.
Thanks in advance
Andy

2000\05\30@090048 by Andrew Kunz

flavicon
face
You can't do this in the emulator, I bet.  It requires changes to several
places.

Are you talking the data memory or the program memory?

Andy

2000\05\30@091915 by Andy Stubbins

flavicon
picon face
Hi Andrew
I am referring to the program memory.


'Reading/writing Smart-cards'
2000\06\07@034115 by Caisson
flavicon
face
Hello all,

 I'm trying to access a Smart-card.  You know those plastic cards :-)
I've got specs that tell me how determine what type of card I've got (T0 or
T1), and it seems to work on a SLE4428 -card.  But my Bank-card (Rabobank,
the Netherlands) does not respond to it.

I've got the specs for a SLE4418 / SLE4428 card that tells me "Reset and
Answer-to-reset", but not what the 32-bit result means (IF it means
anything at all ..).

Does anyone know more about this subject ?  Does anyone have sample-data
(what goes in, what *should* come out  ..)

Does anyone have a PIC-oriented project (going or finished) that I could
use to get me on-the-road ?

Regards,
 Rudy Wieser




By the way:
I've found several sites that describe (simple) interfaces to the serial
port, but they are none-to-clear about which software works for their
designs.

2000\06\07@113150 by Peter Tiang

flavicon
face
Hi Rudy,

<snipped>
> I've got the specs for a SLE4418 / SLE4428 card that tells me "Reset and
> Answer-to-reset", but not what the 32-bit result means (IF it means
> anything at all ..).

   The 32-bit result does not mean anything at all,
   it just IDs the type of IC that is on the smartcard.
>
> Does anyone know more about this subject ?  Does anyone have sample-data
> (what goes in, what *should* come out  ..)

   After the 32-bit ATR, anything goes.
   The protocol can be totally proprietary or even I2C
   like those Xicor devices (X76Fxxx).
{Quote hidden}

   I've designed a simple self-powered serial to smartcard
   interface. All you need is a MAX2323, a 74HC05, a couple
   transistors and passive components.

   It works well for smartcard that does not consume
   more than 5mA (most of them don't, anyway).

   The software are simple bit-banging on the
   RS-232 signals.

Regards,
Peter Tiang

2000\06\07@174128 by Plunkett, Dennis

flavicon
face
Long time no hear!


Dennis

{Quote hidden}

'Writing 16F84 EEPROM'
2000\06\07@181843 by lu01ts

picon face
Hi,

maybe anyone here could help me ! I'm trying to write Pic 16F84 EEPROM
with the following code:

       bsf     STATUS,RP0
       bsf     INTCON,GIE
       bsf     EECON1,WREN

       movlw   0x00
       movwf   EEDATA
       movwf   EEADR

       movlw   0x55
       movwf   EECON2
       movlw   0xAA
       movwf   EECON2
       bsf     EECON1,WR
       bcf     INTCON,GIE

(Yes it's the code from the 16F84 databook :-) )

But within MPLAD Emulator I can't see that the code is written to the
EEPROM ! What's confusing to me is that instead of EEDATA and EEADR , EECON1 and
EECON2 are adressed during the write-operations !

Anyone here got a hit for me ?

--
Sent through GMX FreeMail - http://www.gmx.net

2000\06\07@183754 by Bob Ammerman

picon face
Um, aren't EEDATA and EEADR in bank 0?

Bob Ammerman
RAm Systems
(high performance, high function, low level software)

{Quote hidden}

EECON1 and
> EECON2 are adressed during the write-operations !
>
> Anyone here got a hit for me ?
>
> --
> Sent through GMX FreeMail - http://www.gmx.net

2000\06\07@184220 by Andy Kelley N1YEW

picon face
part 0 228 bytes content-type:application/octet-stream;</x-html>
Content-Type: application/octet-stream;
       name="write.asm"
Content-Disposition: attachment;
       filename="write.asm"

Attachment converted: creation:write.asm (????/----) (000162AC)

2000\06\07@195135 by Sebastian Garcia

flavicon
face
Hi spamBeGonelu01tsspamGMX.NET ,

I suggest the following:

(assuming You're in bank0)

    movlw   0x00
    movwf   EEDATA
    movwf   EEADR

This is why your code don't work, when You did it was in bank1.

|        bsf     STATUS,RP0


    bcf INTCON,GIE    ;to disable interrupts meanwhile the write is in
process

|        bsf     EECON1,WREN
|        movlw   0x55
|        movwf   EECON2
|        movlw   0xAA
|        movwf   EECON2
|        bsf     EECON1,WR

    bsf INTCON,GIE;         ;to enable the interrupts.



Remember that the write time is aprox. 10 ms.

Best Regards,

S.-

'Reading/writing Smart-cards'
2000\06\08@020429 by Dr. Imre Bartfai

flavicon
face
Hi,
could you tell me please the schematic and the software for it? I need to
read exactly that serial from smart card which may be proprietary...
Regards,
Imre


On Wed, 7 Jun 2000, Peter Tiang wrote:

{Quote hidden}

2000\06\08@033607 by Caisson

flavicon
face
> Van: Peter Tiang <spam_OUTpetertiangSTOPspamspamPD.JARING.MY>
> Aan: RemoveMEPICLISTspamspamMITVMA.MIT.EDU
> Onderwerp: Re: Reading/writing Smart-cards
> Datum: woensdag 7 juni 2000 17:31
>
> Hi Rudy,

Hello Peter,

> <snipped>
> > I've got the specs for a SLE4418 / SLE4428 card that tells me "Reset
and
> > Answer-to-reset", but not what the 32-bit result means (IF it means
> > anything at all ..).
>
>     The 32-bit result does not mean anything at all,
>     it just IDs the type of IC that is on the smartcard.

Even worse !   After some more checking-and-re-checking I found out that
the SLE-card is a non-intelligent (as according to the ISO7816-spec).  The
"result" was just memory-data. If I had applied enough clock-pulses, I
would have read-out the total memory ....

>     After the 32-bit ATR, anything goes.
>     The protocol can be totally proprietary or even I2C
>     like those Xicor devices (X76Fxxx).

Hmmm ...  Funny.

>     I've designed a simple self-powered serial to smartcard
>     interface. All you need is a MAX2323, a 74HC05, a couple
>     transistors and passive components.
>
>     It works well for smartcard that does not consume
>     more than 5mA (most of them don't, anyway).
>
>     The software are simple bit-banging on the
>     RS-232 signals.

Yeah.  It's not so much the hardware that gives me a problem, but the
"bit-banging".  Without the right documentation (or without a "real"
smart-card) the development of some interfacing software is going to be
difficult .... :-)

Thanks anyway,
 Rudy Wieser

2000\06\08@121922 by Peter Tiang

flavicon
face
Hi Rudy,

<snipped>
> Even worse !   After some more checking-and-re-checking I found out that
> the SLE-card is a non-intelligent (as according to the ISO7816-spec).  The
> "result" was just memory-data. If I had applied enough clock-pulses, I
> would have read-out the total memory ....
>

   If I'm not mistaken, I read somewhere that these
   SLE cards are intended for telephone card usage
   and the count can only decrement.
   I probably can dig out some more details if you
   really, really need it.

   What do you want to do with these cards anyway ?

<more snipping>
>
> Yeah.  It's not so much the hardware that gives me a problem, but the
> "bit-banging".  Without the right documentation (or without a "real"
> smart-card) the development of some interfacing software is going to be
> difficult .... :-)
>

   Most "real" smartcard contains proprietary OS with
   proprietary protocol.
   It's just one way to prevent hacking.
   Don't even try to analyze the data transfered, as
   these "real" smartcard encrypts the data with different
   key every transaction.

   Worse, the Xicor memory card contains a retry counter,
   if you fail to give the correct password 3 times,
   the whole memory is cleared.

> Thanks anyway,
>   Rudy Wieser
>

Regards,
Peter Tiang

2000\06\08@122135 by Peter Tiang

flavicon
face
Hi Dr Imre,

   I will dig out the schematic and post it on
   the list tomorrow as I got the original design
   from the Web anyway.

   But I can't give you the software as I developed
   it for my company. But it's pretty easy to
   toggle the RS232 signals, even from Win32 apps.

Regards,
Peter Tiang

----- Original Message -----
From: "Dr. Imre Bartfai" <TakeThisOuTrootspamspamRemoveMEPROF.PMMF.HU>
To: <KILLspamPICLISTspamspamspam_OUTMITVMA.MIT.EDU>
Sent: Thursday, June 08, 2000 2:03 PM
Subject: Re: Reading/writing Smart-cards


> Hi,
> could you tell me please the schematic and the software for it? I need to
> read exactly that serial from smart card which may be proprietary...
> Regards,
> Imre
>
>

2000\06\09@031756 by Caisson

flavicon
face
> Van: Peter Tiang <petertiangRemoveMEspamPD.JARING.MY>
> Aan: EraseMEPICLISTSTOPspamspamRemoveMEMITVMA.MIT.EDU
> Onderwerp: Re: [EE]: Reading/writing Smart-cards
> Datum: donderdag 8 juni 2000 18:17
>
> Hi Rudy,
>
>> <snipped>
>     If I'm not mistaken, I read somewhere that these
>     SLE cards are intended for telephone card usage
>     and the count can only decrement.

The card I've got (SLE4428) is nothing more than a EEPROM with a write
protection on it.  You have to enter a access-code (a 16-bit binary word)
to be able to change anyting on the card.  Next to that, individual bytes
can be permanently Write-protected.  So, using them as telephone cards
makes sense.

>     I probably can dig out some more details if you
>     really, really need it.

I've got the Siemens specs for the SLE4418 / SLE4428 laying here, so unless
your docs tell something spectecular, there is noo need.  Thanks for the
offer.

>     What do you want to do with these cards anyway ?

Well, My bos wants to create a Voting-system, and I thought it would be
nice if we could use some card the person has got on him as a sort of ID.
This means I have to be able to read different smart-cards, AND the SLE4428
for someone who does not have a usable card.

> > <more snipping>
>     Most "real" smartcard contains proprietary OS with
>     proprietary protocol.
>     It's just one way to prevent hacking.
>     Don't even try to analyze the data transfered, as
>     these "real" smartcard encrypts the data with different
>     key every transaction.

Well, I did not want to access the "top-secret" data, just some
un-alterable stuff written on it so I can "ID" the guy.

>     Worse, the Xicor memory card contains a retry counter,
>     if you fail to give the correct password 3 times,
>     the whole memory is cleared.

The SLE4428 goes in a permanent Write-protect mode if you fail to enter the
correct access-code 8 times.

Regards,
 Rudy Wieser

'[OT] RS232 to I2C convertor (was Reading/writing S'
2000\06\09@204603 by Peter Tiang

flavicon
face
The link below will give you the schematic
for the self-powered RS232 to I2C convertor

   http://members.xoom.com/usb_gaming/rs232_i2c.pdf

Regards,
Peter Tiang


'[PICLIST] [PIC]Writing to 24LC256'
2000\08\02@085346 by Andy Stubbins
flavicon
picon face
Hi all,
I am using a 24LC256 EEPROM in an application I am involved in, the problem is that I am writing 23 bytes at a time to the device (=1 block) and as soon as I reached the 12th block (address FDh in the IC) the write sequence does not actually occur. I have tried byte writing to the device however the device does not respond to the address high byte rollover for some reason. When I get to the 12th block (i.e. FDh) I have to clear the address low byte and increment the address high byte to continue successfully writing to the rest of the device, this does not seem to follow any logic and I was wondering if any one has had this problem in the past.
best regards
Andy

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\02@112141 by Peter Anderson

flavicon
face
The LC256 will not auto inrement across a page boundary.  Thus when you begin at 00FD, the data will go into addresses 00FD, 00FE, 00FF, 0000, etc.

23 is an awkard number.  Perhaps, use 24 bytes and write this as three blocks of eight bytes.  This will avoid crossing a page boundary when writing any of the blocks.

Peter H. Anderson, spam_OUTphaRemoveMEspamEraseMEphanderson.com, http://www.phanderson.com
PIC C Routines

---- Begin Original Message ----

From: Andy Stubbins <TakeThisOuTandyRemoveMEspam@spam@STUBBINSR.FREESERVE.CO.UK>
Sent: Tue, 1 Aug 2000 13:53:34 +0100
To: EraseMEPICLISTRemoveMEspamMITVMA.MIT.EDU
Subject: [PIC]Writing to 24LC256


Hi all,
I am using a 24LC256 EEPROM in an application I am involved in, the problem is that I am writing 23 bytes at a time to the device (=1 block) and as soon as I reached the 12th block (address FDh in the IC) the write sequence does not actually occur. I have tried byte writing to the device however the device does not respond to the address high byte rollover for some reason. When I get to the 12th block (i.e. FDh) I have to clear the address low byte and increment the address high byte to continue successfully writing to the rest of the device, this does not seem to follow any logic and I was wondering if any one has had this problem in the past.
best regards
Andy

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements


---- End Original Message ----



Sign up for Free-for-Life E-mail at http://www.Africana.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

'[PIC]: writing TRIS/OPT reg's on 16F84?'
2000\08\04@040849 by David D Snyder Hale

flavicon
face
Hi,

I've always used the tris and option commands for 16F84, ignoring the
warning message, "Use of this instruction not recommended."  Now, I
thought I'd do it the recommended way by bank switching and writing the
registers directly.

I select bank1 (bsf STATUS,RP0), then try to write a value to TRISA, TRISB
or OPTION_REG.  However, in each case I receive the error, "Register in
operand not in bank 0. Ensure that bank bits are correct."

Note that the tris & option reg's appear to be getting set properly, but I
don't think these messages are right.  Anyone know what's going on here?

As a demonstration, consider Example 5-1 from the Microchip data manual
for PIC16F8X...

MPASM 02.30 Released EX5-1.ASM 8-4-2000 0:32:39 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
 VALUE
               00001 include "p16F84.inc"
               00001 LIST
               00002 ; P16F84.INC Standard Header File, Version 2.00 Microchip Technology, Inc.
               00136 LIST
2007 3FF1       00002 __config _XT_OSC & _WDT_OFF & _PWRTE_ON
               00003
0000 0185       00004 clrf PORTA
0001 1683       00005 bsf STATUS,RP0
0002 300F       00006 movlw 0x0F
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0003 0085       00007 movwf TRISA
               00008
               00009 end


thanks,

-----------------------------------------------------------------------
David Snyder Hale                     spamdavid.....spamspamisi.mtwilson.edu

Mount Wilson Observatory
(626) 568-0304                        http://isi.mtwilson.edu
-----------------------------------------------------------------------

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

2000\08\04@041513 by Justin Grimm

flavicon
face
Hi
This is not an error, but a warning to ensure the bits are correctly set
Justin
----- Original Message -----
From: David D Snyder Hale <davidspam_OUTspam@spam@ISI9.MTWILSON.EDU>
To: <.....PICLISTspamspam.....MITVMA.MIT.EDU>
Sent: Friday, August 04, 2000 3:57 PM
Subject: [PIC]: writing TRIS/OPT reg's on 16F84?


{Quote hidden}

Microchip Technology, Inc.
>                 00136 LIST
> 2007 3FF1       00002 __config _XT_OSC & _WDT_OFF & _PWRTE_ON
>                 00003
> 0000 0185       00004 clrf PORTA
> 0001 1683       00005 bsf STATUS,RP0
> 0002 300F       00006 movlw 0x0F
> Message[302]: Register in operand not in bank 0.  Ensure that bank bits
are correct.
{Quote hidden}

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

2000\08\04@093451 by Ravi

flavicon
face
Hi David,

> <snip>

>
> I select bank1 (bsf STATUS,RP0), then try to write a value to TRISA, TRISB
> or OPTION_REG.  However, in each case I receive the error, "Register in
> operand not in bank 0. Ensure that bank bits are correct."

After you change the bank... bsf status,rp0, instead of writing to TRISA
or TRISB, write to PORTA or
PORTB. You will not get the message.

Regards

Pailoor

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

2000\08\04@100020 by Bob Ammerman

picon face
----- Original Message -----
From: David D Snyder Hale <EraseMEdavid@spam@spam@spam@ISI9.MTWILSON.EDU>
To: <@spam@PICLISTspamspamKILLspamMITVMA.MIT.EDU>
Sent: Friday, August 04, 2000 3:57 AM
Subject: [PIC]: writing TRIS/OPT reg's on 16F84?


{Quote hidden}

MPASM doesn't know you've set the bank right, and it always complains about
this. If you trust yourself to get it right you just need to add the line:

   errorlevel -302

in your source file. This will shut MPASM up.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

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

2000\08\04@131734 by Olin Lathrop

flavicon
face
> > I select bank1 (bsf STATUS,RP0), then try to write a value to TRISA,
TRISB
> > or OPTION_REG.  However, in each case I receive the error, "Register in
> > operand not in bank 0. Ensure that bank bits are correct."
>
> After you change the bank... bsf status,rp0, instead of writing to TRISA
> or TRISB, write to PORTA or
> PORTB. You will not get the message.

No, please don't do that!  MPASM always warns you whenever you try to access
a register that is not in bank 0, whether this is the correct thing to do in
your code or not.  It still generates the correct code.  You can disable
warnings or some warnings as someone else already suggested.  I use a
wrapper around MPASM that, among many other things, filters out selective
warnings.

Writing to PORTA instead of TRISA only works because PORTA is in the same
location in bank 0 as TRISA is within its bank.  The same code will be
generated but MPASM won't issue the warning because it thinks you are
intending to write into bank 0.  However, this leaves a big mess in the
source code that might cause major headaches in the future when the code is
modified, ported, or whatever.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, spamBeGoneolinRemoveMEspamEraseMEcognivis.com, http://www.cognivis.com

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

2000\08\05@003538 by Ravi Pailoor

flavicon
face
Olin Lathrop wrote:

> > After you change the bank... bsf status,rp0, instead of writing to TRISA
> > or TRISB, write to PORTA or
> > PORTB. You will not get the message.
>
> No, please don't do that!  MPASM always warns you whenever you try to access
> a register that is not in bank 0, whether this is the correct thing to do in
> your code or not.

<snip>

>  However, this leaves a big mess in the
> source code that might cause major headaches in the future when the code is
> modified, ported, or whatever.

Not if you make it a habit of using this method. I have used this method for the
past 5 years and never had a problem when porting the code up or down.

regards

Pailoor
--
Ravi Pailoor
Managing Director
e-CHIP INFOTEK (P) LTD
Member-Microchip consultant program #230-240
INDIA

AIM : "ravipailoor"

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

2000\08\05@145030 by Chamberlain

flavicon
face
David. I replied to one of these not long ago. In Mpasm, set Warning level
to 'Errors only'. I had the same problem. There is no problem.

Chris Chamberlain.
{Original Message removed}

2000\08\05@150701 by Olin Lathrop

flavicon
face
> >  However, this leaves a big mess in the
> > source code that might cause major headaches in the future when the code
is
> > modified, ported, or whatever.
>
> Not if you make it a habit of using this method. I have used this method
for the
> past 5 years and never had a problem when porting the code up or down.

That's your business as long as you are the only one to ever deal with the
source code.  This practise could lead to major headaches and maintenance
cost when someone else has to pick up your code after you've left the
project, got run over by a truck, or whatever.

Do you also use the bank 0 aliases for all the other special function
registers that are in other banks?  Many of them don't map to intuitive
registers that might "remind" someone of the true intended target register.
What about your own variables in banks 1 and up?


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, TakeThisOuTolinspamcognivis.com, http://www.cognivis.com

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestKILLspamspamTakeThisOuTmitvma.mit.edu>

2000\08\06@012004 by Ravi Pailoor

flavicon
face
Olin Lathrop wrote:

> > >  However, this leaves a big mess in the
> > > source code that might cause major headaches in the future when the code
> is
> > > modified, ported, or whatever.
> >
> > Not if you make it a habit of using this method. I have used this method
> for the
> > past 5 years and never had a problem when porting the code up or down.
>
> That's your business as long as you are the only one to ever deal with the
> source code.  This practise could lead to major headaches and maintenance
> cost when someone else has to pick up your code after you've left the
> project, got run over by a truck, or whatever.

I fully agree with you on this.

> Do you also use the bank 0 aliases for all the other special function
> registers that are in other banks?  Many of them don't map to intuitive
> registers that might "remind" someone of the true intended target register.
> What about your own variables in banks 1 and up?

Ok..instead of writing to PORTA or PORTB, you can define TRISA equ 05
and TRISB
equ 06 instead of 85 and 86 and use TRISA and TRISB instead of PORTA and
PORTB.
The same holds good for other SFR's and GPR's.

Setting MPLAB to give error messages only may lead to one more problem.

For example in the code where you want to decrement the contents of a
register
and transfer the value into the W register...

   DECF register

and you have left out the destination W. By default the result will go
into the
same register and since warnings are disabled, you will end up with a
bug.

So the best bet is to have warnings and errors enables and look into
each
warning or error and fix it.

My suggestion was only a method to eliminate the routine warning message
appearing
when working with registers in the other bank.

I am not asking anyone to follow this method as a rule.

Regards

Pailoor

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\06@043005 by Lee Jones

flavicon
face
>>>>  However, this leaves a big mess in the source code that
>>>> might cause major headaches in the future when the code
>>>> is modified, ported, or whatever.

>>> Not if you make it a habit of using this method. I have used
>>> this method for the past 5 years and never had a problem when
>>> porting the code up or down.

>> That's your business as long as you are the only one to ever
>> deal with the source code.

I also agree with this sentiment.


>> Do you also use the bank 0 aliases for all the other special
>> function registers that are in other banks?  Many of them
>> don't map to intuitive registers that might "remind" someone
>> of the true intended target register.  What about your own
>> variables in banks 1 and up?

> Ok..instead of writing to PORTA or PORTB, you can define
> TRISA equ 05 and TRISB equ 06 instead of 85 and 86

Why redefine variables that are already in the include files?

In
       bsf status, rp0   ; select bank 1
       movwf trisa

the warning is being generated because the file register address
operand was wider than 7 bits field in the movwf instruction.

You can fix this problem and, at the same time, include a clue
as to your intentions by the following:

       bsf status, rp0                 ; select bank 1
       movlw some-bit-pattern
       movwf ( trisa ^ 0x80 )          ; style 1
       movwf ( trisa & ~0x80 )         ; style 2
       movwf ( trisa & 0x7F )          ; style 3
       bcf status, rp0                 ; back to bank 0
       movlw some-value
       movwf porta

All 3 styles clear the high order bit in the file register
address operand.  The warning message is no longer emitted as
there is no longer anything "wrong".  Visually, as you read
the code, if the operand has a 0x80 next to it, I know that
I should be working in bank 1.

I personally prefer style 1 using XOR.  That way, if the high
order bit in the operand is already zero (e.g. porta ^ 0x80 ),
then the warning 302 message gets generated and the assembler
helps me to catch the error.

                                               Lee

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\06@050817 by Oliver Broad

flavicon
face
I think this method can be improved even further. Say you define a compiler
variable B and set it to 00 when ever you clear the bank bit, set it to 0x80
when you set the bank bit. Then ALWAYS end address operands with ^B (except
for registers common to both banks).

The assembler will now issue 'correct' warnings.

{Original Message removed}

2000\08\06@084751 by Bob Ammerman

picon face
>         movwf ( trisa ^ 0x80 )          ; style 1
>         movwf ( trisa & ~0x80 )         ; style 2
>         movwf ( trisa & 0x7F )          ; style 3

Excellent idea. I too vote for style 1.  How about including it in a macro:

#define INBANK1(x)  ((x) ^ 0x80)

   movwf    INBANK1(trisa)

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\07@122920 by Harold M Hallikainen

picon face
       If you eventually port up to the 18c series, there'll be a problem since
the PORT and TRIS registers are all in the same bank.

Harold



On Sat, 5 Aug 2000 13:49:51 -0400 Olin Lathrop
<EraseMEolin_piclist.....spamKILLspamCOGNIVIS.COM> writes:
{Quote hidden}

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

--
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]:16F873 writing to flash problem'
2000\09\16@043735 by Damien Kee
flavicon
picon face
just wondering if anyone could help.

I'm using a 16F873 as a data logger, and am storing the data in
flash.  Yes I know that I should really put it into serial EEPROM, but it
is for a Uni project, so space and cost are an issue.  I'm having a
problem though, writing to flash.

I write several(5) chars to sucessive flash program space, but then when
I try and read them back, I get the last character that I wrote, 5 times.

was wondering if there is something obvious in the notes that I have
missed, and/or if anyone has any good links to example code which does
this sort of stuff, which I could have a look at.

cheers
damo


Damien Kee
3rd Year Electrical Engineering
University of Queensland
s369472STOPspamspamKILLspamstudent.uq.edu.au

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


2000\09\16@085546 by Dale Botkin

flavicon
face
Sounds like you have a counter not incrementing, either on write (most
likely) or on read.  Maybe you could post that section of code and have
folks take a look.

Dale

On Sat, 16 Sep 2000, Damien Kee wrote:

{Quote hidden}

---
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
               -- Isaac Asimov

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


2000\09\16@120548 by Olin Lathrop

flavicon
face
> I write several(5) chars to sucessive flash program space, but then when
> I try and read them back, I get the last character that I wrote, 5 times.

This sounds like it might be more of a reading than a writing problem.
Anything's possible of course, but it seems a bit unlikely that your write
routine would mess up by filling a region of memory with the same value.
That would require multiple writes, which is something you should be able to
easily check with a scope.  However, suppose your read routine was messed up
where it just ends up getting back whatever is in some data holding
register, which is whatever value was last written regardless of where it
was written to.

I don't know the specifics of your memory, so take this for what it's worth.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, spamolin.....spam.....cognivis.com, http://www.cognivis.com

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


2000\09\17@062719 by Damien Kee

flavicon
picon face
ok, here are the bits of code relevant.

It's all in c.

In the interrupt handler:
{
               write_flash2(1865, 'A');
               write_flash2(1866, 'B');
               write_flash2(1867, 'C');
               write_flash2(1868, 'D');
               write_flash2(1869, 'E');
               write_flash2(1870, 'F');

               a = read_flash2(1865);
               b = read_flash2(1866);
               c = read_flash2(1867);
               d = read_flash2(1868);
               e = read_flash2(1869);
               f = read_flash2(1870);

               send_char(a);
               send_char(b);
               send_char(c);
               send_char(d);
               send_char(e);
               send_char(f);
}

send_char just sends the value through RS232 to hyperterminal.

the actual functions are as below:
void write_flash2( int addr, char data )
{
       EEADRH = 0x00;
       EEADR = 0x00;
       EEDATA = 0x00;
       EEDATH = 0x00;
       //Write flash
       EEADRH = addr / 256;
       EEADR = addr % 256;
       EEDATA = data;

       set_bit( EECON1, EEPGD);
       set_bit( EECON1, WREN );
       EECON2 = 0x55;
       EECON2 = 0xAA;
       set_bit( EECON1, WR );
       asm nop;
       asm nop;
       clear_bit( EECON1, WREN );
}

char read_flash2(int addr ){
       EEADRH = 0x00;
       EEADR = 0x00;
       EEDATA = 0x00;
       EEDATH = 0x00;
       //Read flash
       EEADRH = addr / 256;
       EEADR = addr % 256;
       set_bit( EECON1, EEPGD);
       set_bit( EECON1, RD );
       asm nop;
       asm nop;
       data_rd = EEDATA;
       send_char(EEDATA);
       return data_rd;
}

I'm doing the mod and divide functions, because I'd like to keep the
destination address as 1 integer.  If there is a better way, I love to
know.

thanks again.

cheers
damo




Damien Kee
3rd Year Electrical Engineering
University of Queensland
s369472.....spamstudent.uq.edu.au

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use KILLspamlistservspam_OUTspammitvma.mit.edu?body=SET%20PICList%20DIGEST


2000\09\17@113523 by Byron A Jeff

face picon face
Damien,

It takes time to write to a flash/eeprom memory. From a brief glance at the
code below it doesn't look like you're allowing for the write to complete
before continuing to the next write.

According to the data sheet (which doesn't seem to list a timing parameter
for a flash write) a write is complete when the EEIF flag in the interrupt
register is set. So in your code in the write_flash2 you need to replace
the two nops with a while loop that waits for the EEIF flag to become set.

Note that your code must reset that flag. It doesn't happen automatically.

BAJ
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use spam_OUTlistservTakeThisOuTspamEraseMEmitvma.mit.edu?body=SET%20PICList%20DIGEST


2000\09\17@142734 by Dale Botkin

flavicon
face
On Sun, 17 Sep 2000, Damien Kee wrote:

> ok, here are the bits of code relevant.
>
> It's all in c.

Which C compiler?

{Quote hidden}

Looks OK to me so far...

> send_char just sends the value through RS232 to hyperterminal.
>
> the actual functions are as below:
> void write_flash2( int addr, char data )
                    ^^^^^^^^^
Umm, shouldn't this be long instead of int?  I know at least with CCS and
CC5X you need to use long or int16 if you're going to pass values greater
than 255.

{Quote hidden}

Dale
---
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
               -- Isaac Asimov

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use @spam@listservspamspammitvma.mit.edu?body=SET%20PICList%20DIGEST


2000\09\18@044627 by Damien Kee

flavicon
picon face
Ok, now I'm getting desperate.

I've posted the code at student.uq.edu.au/~s369472/pic/flash1.c

I'm using the C2C++ compiler.

From the code you can see that I write 5 chars to five incrementing
address spaces, then I read back the 5 chars and send them to a hyper
terminal.  Only when they are read, they are all the same.

I've analysed the asm file generated, and it follows the Microchip
datasheet.

I'm really at a loss now as to what to do, and have spent about 2 days
straight trying to solve it.  It is incredably annoying when I have
managed to write all the code necessary for the rest of the project,
teaching myself as I go, in about 5 days, and then to be
stuck on this final hurdle.

thanks to everyone so far for their help,

cheers
damo


Damien Kee
3rd Year Electrical Engineering
University of Queensland
TakeThisOuTs369472KILLspamspam@spam@student.uq.edu.au

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


2000\09\18@051811 by Michael Rigby-Jones

flavicon
face
{Quote hidden}

The following function contains some code that I suspect was put in for
debugging :


char read_flash2(long addr ){
       EEADRH = 0x00;
       EEADR = 0x00;
       EEDATA = 0x00;
       EEDATH = 0x00;
       EEADRH = addr / 256;
       EEADR = addr % 256;

       EEADRH = 0x00 ;  You are setting the read address to a constant
here.
       EEADR = 0xFF ;

       set_bit( EECON1, EEPGD);
       set_bit( EECON1, RD );
       asm nop;
       asm nop;
       delay_ms(10);
       data_rd = EEDATA;
       return data_rd;
}

I don't have the 16F877 datasheet to hand, but I suspect there may also be
some timming issues in your flash_write2 function. IIRC you have to poll a
status bit to find out when the flash has finiched being written to.

Cheers

Mike

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



'[PIC]: Problems writing to PORTB with CCS'
2000\10\04@111244 by jeff
flavicon
face
I know that I'm going to learn something here that I will never make the
same mistake on again, but I am having a major problem with code that I have
developed.  I am writing a hexidecimal value to PORTB and the value is not
always the same as what I wrote to it.  I set breakpoints immediately after
I set the value and I still see the difference so I know that something else
that I have done is not modifying it.  Originally I was using a lookup table
to get my values but to simplify and try to debug this problem I am just
writing the output to the port manually.  The values are always close to
what I have written but they are not always correct.  It also seems that
bits 2 or 3 are the bits affected.  Here is the code that I'm using (excuse
all the commented out because I am trying to simplify to isolate the
problem).

Any help on this would be greatly appreciated!

#include "o:\projects\safari\Safari.h"

/// The following are manually added definitions
#byte PORTB = 0x06
#define ALL_OUT 0x00
#define ALL_IN  0xFF

//int mirror;
//int direction; // which direction are we moving?
int angle;       // sinelookup pointer

//int sinelookup[19] =
{1,3,9,17,31,47,65,85,105,129,151,171,191,209,225,239,247,253,255};

#int_rtcc
rtcc_isr() {

switch (angle){

Case 0:
// mirror = sinelookup[angle];
PORTB = 0x00;
angle++;
// if (angle++ >= 17){
//    direction = 2;
// }
break;

Case 1:
PORTB = 0x2D;
angle++;
break;

Case 2:
PORTB = 0x57;
angle++;
break;

Case 3:
PORTB = 0x7F;
angle++;
break;

Case 4:
PORTB = 0xA3;
angle++;
break;

Case 5:
PORTB = 0xC3;
angle++;
break;

Case 6:
PORTB = 0xDD;
angle++;
break;

Case 7:
PORTB = 0xEF;
angle++;
break;

Case 8:
PORTB = 0xFB;
angle++;
break;

Case 9:
PORTB = 0xFF;
angle=0;
break;
}

output_low(PIN_B0);
delay_us(10);
output_high(PIN_B0);

return;
}

#int_adcc
adc_isr() {

}

#int_eeprom
eeprom_isr() {

}

#int_timer1
timer1_isr() {

}

#int_timer2
timer2_isr() {
}

void main() {

  setup_adc_ports(A_ANALOG);
  setup_adc(ADC_CLOCK_DIV_2);
  setup_spi(FALSE);
  setup_psp(PSP_DISABLED);
  setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
  setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
  setup_timer_2(T2_DIV_BY_16,1,1);
  setup_ccp1(CCP_OFF);
  setup_ccp2(CCP_OFF);
  enable_interrupts(INT_RTCC);
//   enable_interrupts(INT_ADC);
//   enable_interrupts(INT_EEPROM);
//   enable_interrupts(INT_TIMER1);
//   enable_interrupts(INT_TIMER2);
  enable_interrupts(global);

  set_tris_b(ALL_OUT);    // Set all pins on PORTB as Outputs
  PORTB = 0x00;           // Set all pins on PORTB Low

  angle = 0;              // Initialize angle pointer
// direction = 1;          // and direction.

   do {

   } while(TRUE);

}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's


2000\10\04@112109 by Simon Nield

flavicon
face
Could be that whatever circuitry you have connected to portb is affecting things. If you can
physically disconnect the port from anything else (including pull up resistors or whatever) then do
so and see if this changes anything... A scope would be a great help to you here if you can get hold
of one.

Regards,
Simon

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's


2000\10\04@130552 by David Kott

flavicon
face
See intra-code comments below....

> I know that I'm going to learn something here that I will never make the
> same mistake on again, but I am having a major problem with code that I
have
> developed.  I am writing a hexidecimal value to PORTB and the value is not
> always the same as what I wrote to it.  I set breakpoints immediately
after
> I set the value and I still see the difference so I know that something
else
> that I have done is not modifying it.  Originally I was using a lookup
table
> to get my values but to simplify and try to debug this problem I am just
> writing the output to the port manually.  The values are always close to
> what I have written but they are not always correct.  It also seems that
> bits 2 or 3 are the bits affected.  Here is the code that I'm using
(excuse
> all the commented out because I am trying to simplify to isolate the
> problem).

...

{Quote hidden}

Aha!  output_low induces a Read-Modify-Write operation, probably a "BCF
06,0".  The contents of PortB (the *real* PortB, not your variable) are
read, bit 0 is reset, and the contents are written out to the port.  Now, if
your outputs haven't stabalized before this operation reads the status of
the outputs, you will get invalid results asserted on your port.

Quoting from the 16F87X manual:
"All write operations are read-modify-write operations.
Therefore, a write to a port implies that the port pins are
read, the value is modified and then written to the port
data latch."(c)

How about putting an obscenely long delay *after* the end of the switch
statement closing brace and *before* your output_low() instructions to see
if this helps.  Thusly:

...
> Case 9:
>  PORTB = 0xFF;
>  angle=0;
> break;
> }
>

// Give the output pins some time to stabilize before another RMW
instruction corrupts
// information on our port.
DELAY_US(100);


> output_low(PIN_B0);
> delay_us(10);
> output_high(PIN_B0);
>
...

Note that this isn't such a problem with your PORTB=lvalue statements.
Those compile to something like this:

03882 ....................  PORTB=0XFF;
03883 MOVLW  FF
03884 BCF    03,5
03885 MOVWF  06

This doesn't involve RMW instructions.

My 0x02 cents.
-d

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's



'[EE]:writing data to IBM PC parallel port to drive'
2000\12\28@160244 by Pramod Kotwal
flavicon
face
This is about using an IBM PC parallel port to drive a bipolar stepper
motor. So I hope it not too far off topic here.

I would like to use C to to send the appropriate signal to the data port
bits on the parallel port. P.H. Anderson gives a very nice and clear
explanation of how to do it .

The problem I have is in defining the delay between two subsequent commands
to write the bit to the port. This time interval will define how fast the
motor will turn.

The command to wrie data to the port is
outportb(port address, data).

The interval between writing data is controlled by the
delay(time) command.
This command seems to read time in milliseconds.

If this correct, the shortest delay I can specify is 1 millisecond between
steps. This would mean that on stepper motor with 200 steps per revolution I
can, at best get 5 rpm.

This does not make sense to me. Where am I going wrong ?

I will appreciate help.
Pramod Kotwal

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2000\12\28@161954 by John De Villiers

flavicon
face
dont use delay - its too slow

I think the trick was to do a port read ( one of the status bits or
something equially arbitary ). Those take 1 microsecond

The fastest i was able to go was about 50 us before the stepper started
skipping beats. It also depends if youre half stepping or full stepping. I
also suggest you use a tranny of some sort as the pc par port can let out
its smoke if you draw too much from it. I used normal TIP31's as i had a
whole box full of them.

I found full stepping, but with 2 coils energized ( half step position, but
full step increments ) gave me the best torque.

John

{Original Message removed}

2000\12\28@164141 by Herbert Graf

flavicon
face
{Quote hidden}

    Nowhere, that is about the best you will get using the delay routine.
Solution? Don't use the delay routine! As a small good side to this is I
have found that the delay routine isn't very good, multitasking environments
seem to really screw it up. How important is the accuracy of how fast you
need to go? If it isn't too critical you can use a simple FOR loop as a
delay. Stick an inp to nowhere in the loop (since inp's can't be cached they
almost always take an equal amount of time to execute) and run through the
loop a bunch of times. Unfortunately this is highly machine dependant. If
you do indeed need good accuracy or machine independence you'll have to do
it another way. Interrupts would probably be the solution using the timer in
every PC. Unfortunately this is MUCH more complicated to accomplish well.
TTYL

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2000\12\28@164437 by Pramod Kotwal

flavicon
face
Hi John,

Thanks for the tip.

If I understand you correctly, if I make a loop and read from a status port
n times before writing the next step I should get an interval of n
microseconds.

Neat.

I am not planning to use the port to drive the coils directly. Thanks for
the warning.
Pramod

----- Original Message -----
From: "John De Villiers" <.....bbjEraseMEspamPLZ.CO.ZA>
To: <spamBeGonePICLISTspamRemoveMEMITVMA.MIT.EDU>
Sent: Thursday, December 28, 2000 4:15 PM
Subject: Re: [EE]:writing data to IBM PC parallel port to drive stepper


{Quote hidden}

but
> full step increments ) gave me the best torque.
>
> John
>
> {Original Message removed}

2000\12\29@011523 by Roman Black

flavicon
face
Pramod Kotwal wrote:
>
> This is about using an IBM PC parallel port to drive a bipolar stepper
> motor. So I hope it not too far off topic here.
> The problem I have is in defining the delay between two subsequent commands
> to write the bit to the port. This time interval will define how fast the
> motor will turn.
>
> The command to wrie data to the port is
> outportb(port address, data).
>
> The interval between writing data is controlled by the
> delay(time) command.
> This command seems to read time in milliseconds.

You can use high res timinbg quite painlessly with the
PC, you sense the PIT timer chip and get a count in
microseconds, (actually 1.194MHz going from my memory)
and you can then loop and sense this count and time
things quite accurately. I did 3 years as a games
graphics engine programmer, had to time everything by
vertical retrace for screen draws.
:o)
-Roman

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


2000\12\29@015434 by Nigel Goodwin

flavicon
face
In message <003d01c07110$8cbebde0$.....6501a8c0EraseMEspamprospeed.net>, Pramod Kotwal
<spampramodkotwalspam_OUTspam@spam@NITRON.NU> writes
>The interval between writing data is controlled by the
>delay(time) command.
>This command seems to read time in milliseconds.
>
>If this correct, the shortest delay I can specify is 1 millisecond between
>steps. This would mean that on stepper motor with 200 steps per revolution I
>can, at best get 5 rpm.
>
>This does not make sense to me. Where am I going wrong ?

Only in that the speed would be 5 revs per SECOND - not per minute!,
giving a maximum speed of 300rpm. Given that this is the PICList, why
not use a PIC to interface between the serial port and the stepper
motor, you could than send commands to the PIC via the serial port, and
the PIC can do all the fast timing required?.
--

Nigel.

       /--------------------------------------------------------------\
       | Nigel Goodwin   | Internet : spamnigelg@spam@spamSTOPspamlpilsley.co.uk           |
       | Lower Pilsley   | Web Page : http://www.lpilsley.co.uk       |
       | Chesterfield    | Official site for Shin Ki and New Spirit   |
       | England         |                 Ju Jitsu                   |
       \--------------------------------------------------------------/

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


2000\12\29@101237 by Pramod Kotwal

flavicon
face
Hi,

I realized that I would be getting 300 rpm after I had already sent the mail
to the PIClist. Thanks anyway.

I did learn about the trick of timing by reading data, so my request did
help me.

Using a PIC to do the timing is certainly an option that I am studyinng now.
I does have several advantages beyond the timing routines. So you might see
me here later if I run into difficulties.

Thanks for the pointers etc.
Pramod Kotwal

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


'[OT]: Writing Windows device driver'
2000\12\29@121922 by Steven J. Devine

flavicon
face
> As far as books, there is nothing like the definative source, which is the
> Microsoft DDK.  Most of the books I've seen on this subjet are just
> regurgitated versions of the DDK with more hand holding.  Sorta like "Device
> drivers for dummies".  Frankly, if your at that level you shouldn't be
> trying to write a device driver.

Well, I would disagree with that statement... everyone who is writing device drivers has to have written their FIRST device driver.  If one does not have the opportunity to write them professionally under athe guidance of a seasoned veteran, then a guide with more hand-holding is ideal, if not required, for experimentation in writing device drivers.

This is how I had to learn much of what I'm doing now, and continue to learn in this way (including writing code for the PIC).

Background, environment, and resource availability play crucial roles in how people learn what they need to know to get the job done... particularly if we're talking about hobbyists, not professional programmers.

Steve Devine
------------------------------------------------------------------------
Steven J. Devine, President, Consultant, TZOGON Enterprises Incorporated
spamBeGonestevespamBeGonespam@spam@tzogon.com          HAM Tech lic: N1YZJ      http://www.tzogon.com
               http://www.tzogon.com/~steve/glass_cockpit
                 http://www.tzogon.com/~steve/stolch801
------------------------------------------------------------------------

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


'[EE]:writing data to IBM PC parallel port to drive'
2000\12\29@230415 by Daniel Jircik

flavicon
face
I have a  BUNCH of stuff i wrote in QBASIC a few years back, and it can use an
analog joystivk (db15 game) works great. If you would like them, will send to
you off list.
Daniel Jircik
RemoveMEpannomatRemoveMEspamRemoveMEswbell.net

Herbert Graf wrote:

{Quote hidden}

--
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]: strange output port REWRITING'
2001\01\05@084020 by RoDelta
flavicon
face
Hi! Thanks for the answer.
The center of the question is the strange behaviour of the RA4 in Pic16C621A
and not drive a relay or other periferal problems.
Rewriting the question :
I suspect that we are in front a hardware Microchip bug or much probabily,
wrong sets.
I made this experience (in two pics 16C621A, first j/w and second otp, the
output is not damaged):
1- I put a 10K (or only 1K, 5ma,  if prefer) pullup resistor in RA4 . And
run a simple code .
This code initialize turn off comparator , set RA4 as out put and finaly set
high this port and go to a infinity loop with nop. Sets as below :
My sets:
banc1                                       ;macro to bank 1
MOVLW  b'00000010'           ;Place option reg setup into W
MOVWF  OPTION_REG       ; Set up OPTION register
MOVLW   b'00000011'           ; RA0 and RA1 as intput RA2,3 and 4 as output
MOVWF  TRISA                      ;
banc0                                        ;macro to bank 0
MOVLW  b'00000111'            ;07h comparator off
MOVWF  CMCON
MOVLW  B'10100000'            ; int only to tmr0
MOVWF  INTCON
VRCON, I left by default. (b'00000000')  (Any problem here?)
Then
BSF    PORTA, 4       ; set ra4 high
and now put in infinit loop (goto nop, for exemple)

   Note, with this code, no write modify read operation occur. The RA4 is
statically set (high)
2- Measuring the voltage in output is high (presice 5V, is a open drain with
pullup!)
3-Now I conect a cupper wire in pin 3(ra4) to zero and after remove this
wire (current limited in 0,5ma by 10K resistor ).
4- Then, now  the expected voltage on RA4 is obviously 5V(conform item 2),
but surprise is zero!!! (clear by external circuit???!!!)
       More information :
5-If the value by external circuit mantain the voltage over Vdd/2
(independent off the current value), when remove this circuit the output
stays in 5V.
6-If the value by external circuit force the voltage any value below Vdd/2
(independent off the current value),  when remove this circuit the RA4 (pin
3) output is zero!!!!
7-The same experience (same conditions)  with 16F84, the item 4,above,  the
voltage return to 5V as expected.

My conclusion, probabily :
1- Wrong set due comparator, but not is evident in data sheet.
2-16C621A RA4 output is not an i/o  bidiretional port with a open drain cmos
component !
3-Finally a hardware PIC bug (minus probabily, I expect)

A precary solution, based in item  5 and 6, sugest to drive a relay via npn
transistor, the base can't conected direct in pin 3,  because Vbe < Vdd/2.
But, what kind of output component is this?
TIA
Roberto Locks

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


'[PIC]:reading/writing 16F87x program memory'
2001\01\26@104750 by Mike Mansheim

flavicon
face
When reading/writing the 16F87x program memory from itself, can the
configuration word be accessed?
I'm looking at this with a 16F876 (on an emulator so I can watch
registers), using the "flash program read" code from the data sheet
verbatim.  I can read locations 0-1FFFh ok, but when I try to read 2007h,
EEADRH gets changed from 20h to 0.  I don't see any obvious bit in
EECON1 that might have something to do with this.
In the intro discussion of this section, the datasheet says "These devices
can have up to 8K words of program EEPROM with an address range from 0h to
3FFFh", which is the same address range mapped out in the programming
spec for this part - leading me to believe I would be able to access the
configuration word.
Thanks for any help.

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-request@spam@spammitvma.mit.edu


2001\01\26@114807 by M. Adam Davis

flavicon
face
Mike Mansheim wrote:
> When reading/writing the 16F87x program memory from itself, can the
> configuration word be accessed?

Nope.

{Quote hidden}

What you say is confusing.  If you are emulating an '876, then you have
the full 8k of programming memory, or, in other words, you should be able
to read 0x2007 just fine - it's within the program memory.  On this
particular chip the configuration word is outside this area, and you can't
go past 0x3fff.

-Adam

> Thanks for any help.
>
> --
> http://www.piclist.com hint: To leave the PICList
> TakeThisOuTpiclist-unsubscribe-requestspam_OUTspammitvma.mit.edu

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-request.....spamTakeThisOuTmitvma.mit.edu


2001\01\26@121039 by Darrel Johansen

picon face
>When reading/writing the 16F87x program memory from itself, can the
>configuration word be accessed?
>I'm looking at this with a 16F876 (on an emulator so I can watch
>registers), using the "flash program read" code from the data sheet
>verbatim.  I can read locations 0-1FFFh ok, but when I try to read 2007h,
>EEADRH gets changed from 20h to 0.  I don't see any obvious bit in
>EECON1 that might have something to do with this.
>In the intro discussion of this section, the datasheet says "These
devices
>can have up to 8K words of program EEPROM with an address range from 0h
to
>3FFFh", which is the same address range mapped out in the programming
>spec for this part - leading me to believe I would be able to access the
>configuration word.
>Thanks for any help.

I don't know where you are seeing this 3FFF number,  there are 0x4000
bytes
of program memory, but they are addressed as 14-bit words from 0 to
0x1FFF.

The configuration bits cannot be read by your program in this part.  (The
18Cxxx
parts, however can read their config and ID bits.)  The config words at
200x
are just a convention for the tools to use.  When they see data at this
address
for the 16F87x devices, they put the chip into a special mode and program
the
config bits.

Program memory can be used for storage, but it doesn't have the same
capability
of R/W's that general purpose RAM storage has.  This parameter is called
"endurance," and for these flash parts starts to degrade at high temps (85

degrees C).  This is specified as absolute worst case, and so far we
haven't
seen MPLAB ICD's being reported as unprogrammable anymore, and we may
never see it.  I think that the worst case spec is something like a
thousand
reprogramming cycles before the odds are that one word will be
unprogrammable
at 85 degrees C operating.  Please consult the actual endurance specs for
your application.  My comments are for general information only and should
not be used for the purposes of establishing endurance values.

Darrel Johansen

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



'[PIC]: reading/writing to external SRAM'
2001\03\26@024718 by s.m.brady
picon face
hello,

I am in need of some guidance please.
I am using a 17c44  with 4Mhz crystal and writing extenally to M48z02-70(16
Kbit Zeropower SRAM for ST) .
I am trying to read and write a 16 bit munber. In Mplab simulation it seems
to run fine BUT in my circuit the chip seems to write only 8 bits and reads
16bits, from looking at the data on a logic analyser. I can write 0xaa to
the lower 8 bits but do nto seem to be able to get 0x55 written into the
upper 8 bits. I do read all 16 bits.

Am I missing something simple or maing a silly mistake? Please help as I am
going around in circles

Thank you

Sharon


The bones of the code is below:

//temp data memory locations
static unsigned char high_mem1   @ 0x22;
static unsigned char low_mem1     @ 0x23;

//temp storage for read data
static unsigned char hr_mem1      @ 0x32;
static unsigned char lr_mem1      @ 0x33;

lr_mem1=0x00;   //clearing memory locations
hr_mem1=0x00;

high_mem1=0xaa;
low_mem1=0x55;

void main ()
{

//initialisation here
for(;;)
   {
    CLRWDT();

 for(i=0;i<32000;i++)  // routine writing to SRAM from
   {
     CLRWDT();
     GLINTD=1;
     Write1();
     GLINTD=0;
   }

    for(i=0;i<32000;i++)
    {
      CLRWDT();
      Read1();
    }
  }
}

void Write1(void)
{
#asm
     CLRWDT                    ; clear the watch dog timer
       movlw    128                    ; load the table pointer with 0x8000 in SRAM
       movwf    _TBLPTRH               ;
       clrf     _TBLPTRL               ;
       tlwt     1, _high_mem1    ; high byte @ table latch    // does not seem to
write this
       tablwt 0,1, _low_mem1   ; low byte @table latch         // writes 0xaa here
#endasm
}


void Read1(void) // transfer of 8 bytes of data from program(external)
memory
                     // to data memory starting at 0x30
{
CLRWDT();               // clearing watchdog timer
#asm

       movlw    128            ; load the table pointer with 0x8000
       movwf   _TBLPTRH        ;
       clrf    _TBLPTRL        ;
       tablrd  0,1, _lr_mem1   ; get 16 bit value in table latch
       tlrd    0, _lr_mem1      ; low byte @table latch, latch @prob.mem   // reads
0xaa                                                                                                        successfully
       tablrd  1, 1,_hr_mem1   ; high byte @ table latch       // reads a random
value.. 1's
#endasm
}

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


'[PICLIST] CCS C - Reading and Writing Program EEPR'
2001\03\29@164521 by Lawrence Lile

flavicon
face
I'm using a 16F877 part, which allows reading and writing to the program
memory area for data storage.

I notice the functions

               WRITE_PROGRAM_EEPROM(address, data)    and
               i=READ_PROGRAM_EEPROM(address)

should theoretically be able to handle up to 14 bit numbers, since the
program area is 14 bits deep.  Does this mean that the functions both use
longs (two byte numbers), AKA WRITE(data) should be passed a long, and READ
should return a long?


How do you insure that your reading and writing is not trashing real program
memory area?  Is it wise to protect the lower end of the PIC's program
memory to prevent this, and use addresses in the upper end of the memory, or
is this neccesary?  I'd hate to write over my program with a string of
temperature data.

-- Lawrence Lile
Sr. Project Engineer
Salton inc. Toastmaster Div.
573-446-5661 Voice
573-446-5676 Fax

--
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\03\29@204617 by Bob Ammerman

picon face
> I'm using a 16F877 part, which allows reading and writing to the program
> memory area for data storage.
>
> I notice the functions
>
>                 WRITE_PROGRAM_EEPROM(address, data)    and
>                 i=READ_PROGRAM_EEPROM(address)
>
> should theoretically be able to handle up to 14 bit numbers, since the
> program area is 14 bits deep.  Does this mean that the functions both use
> longs (two byte numbers), AKA WRITE(data) should be passed a long, and
READ
> should return a long?

That would depend on how the functions were implemented, but they certainly
could use 14 bit numbers.

> How do you insure that your reading and writing is not trashing real
program
> memory area?

By being very careful what values you pass to the WRITE_PROGRAM_EEPROM
instruction.

> Is it wise to protect the lower end of the PIC's program
> memory to prevent this, and use addresses in the upper end of the memory,
or
> is this neccesary?  I'd hate to write over my program with a string of
> temperature data.

I wouldn't use memory protection for this. If your program is buggy enough
to write over itself that is probably a good thing :-)

Two other points:

1: remember that program eeprom has a much lower endurance than data eeprom

2: while writing program eeprom your program can be doing nothing else
(everything is frozen)

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

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



'[EE]: device for writing to Award flash bios chips'
2001\04\01@055645 by Someone Else
flavicon
face
Hello.
This is my first post to this list. I am interested in coming into contact
with people who have information as to how to build a device which you can
write bios to Award Flash Bios chips, type: those that are in pc motherboards.
This may for many of you be relatively easy, but I have never built such a
device. I am interested in building a device similar of design to this:
members.tripod.com/~mehlkloss/ludipipo.zip
This is mainly due to curiosity, also fascination with making something and
seeing if it works. I am also interested in learning more about this, and how
you can program bios to the chip, which software is used, etc.
If I am asking for the obvious, please excuse me as I am a novice in this
field.
As I am from Norway, please excuse my poor English.

Regards,
Eivind.

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


2001\04\01@111823 by Byron A Jeff

face picon face
>
> Hello.
> This is my first post to this list. I am interested in coming into contact
> with people who have information as to how to build a device which you can
> write bios to Award Flash Bios chips, type: those that are in pc motherboards.
> This may for many of you be relatively easy, but I have never built such a
> device. I am interested in building a device similar of design to this:
> members.tripod.com/~mehlkloss/ludipipo.zip
> This is mainly due to curiosity, also fascination with making something and
> seeing if it works. I am also interested in learning more about this, and how
> you can program bios to the chip, which software is used, etc.
> If I am asking for the obvious, please excuse me as I am a novice in this
> field.
> As I am from Norway, please excuse my poor English.

First off there is nothing poor about your English. It's better than many of
my students' who have spoken/learned English their whole lives.

As to the answer to your question, generally currently motherboards are
flash based and any required circuitry to reprogram it comes on the
motherboard. So in short, all reprogramming the motherboard requires is
the appropriate software.

A really good site that talks about reflashing BIOS is http://www.badflash.com.

Take a look.

BAJ
>
> Regards,
> Eivind.
>
> --
> http://www.piclist.com hint: To leave the PICList
> spampiclist-unsubscribe-requestspam_OUTspammitvma.mit.edu
>
>

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


2001\04\01@122126 by Someone Else

flavicon
face
>First off there is nothing poor about your English. It's better than many of
>my students' who have spoken/learned English their whole lives.

Thank you.

>As to the answer to your question, generally currently motherboards are
>flash based and any required circuitry to reprogram it comes on the
>motherboard. So in short, all reprogramming the motherboard requires is
>the appropriate software.

The motherboard of which the bios I want to program is no longer operative,
due to a mishap during flashing of bios.  So basicly flashing bios won't be
possible unless you can get the board to start up, and this one gives no
indication that it's doing anything of the sort.
So really what I want to do is to remove the chip, and reprogram it with the
bios downloaded from the official mb webpage.  I have flashed bios before in
motherboards that actually work, so I do know how, but now I want to create an
external device which will let me program the award flash bios chip.  But I
can see how what I said before could be mistaken for lack of knowledge.

>A really good site that talks about reflashing BIOS is http://www.badflash.com.

This is a site which lets you order new bios-chips for $20.  I was interesting
in building this device for approximately the same ammount, at most $35...
just hope someone knows how.

Eivind.

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


2001\04\01@134304 by Sean H. Breheny

face picon face
Dear Eivind,

I designed and built a programmer for the flash chips that were most common
around 1997 (I don't know if they are still the most common, it was
designed for 28Fxxx series chips). It requires a 12V supply, and uses a
PIC16C65 or C67, a max233 serial level converter IC,plus a few other small
components. It's companion software on the PC side accepts Motorola S
format or Intel HEX format files. If you are interested, I can send you the
files and schematic.

Sean

At 12:19 PM 4/1/01 -0400, you wrote:
>This is a site which lets you order new bios-chips for $20.  I was interesting
>in building this device for approximately the same ammount, at most $35...
>just hope someone knows how.
>
>Eivind.
>
>--
>http://www.piclist.com hint: To leave the PICList
>EraseMEpiclist-unsubscribe-requestspamKILLspammitvma.mit.edu

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


2001\04\01@152046 by Dave

flavicon
face
Hi,

Are you the same person who was asking this on IRC in #PIC the other night?
I don't know much about writing to BIOS except that it is extremely
dangerous. I don't quite get why you would like to take such a risk just out
of curiosity. Besides, motherboard manufacturers give away perfectly good
BIOS flashing tools. The only people I could imagine having an interest in
this are people writing harmful virus's.

I'm sure you are not trying to do this for illegitimate purposes but I'm
sure you can see how I could come to this opinion.

Regards,
David Stubbs
WEB: http://www.nti-uk.com
TEL UK: 07968 397782


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


2001\04\01@152915 by Tim Hamel

picon face
In a message dated 4/1/01 9:22:03 AM Pacific Daylight Time,
@spam@bp19EraseMEspamspamOPERAMAIL.COM writes:


> The motherboard of which the bios I want to program is no longer operative,
> due to a mishap during flashing of bios.  So basicly flashing bios won't be
> possible unless you can get the board to start up, and this one gives no
> indication that it's doing anything of the sort.
>

Ahh...the infamous corrupt Flash programming. If you're lucky...this Flash
chip MIGHT have a section in it's memory known as the "boot-block."
Basically, the boot block provides the minimum amount of code to boot the
system up ONLY to the point where it can read the floppy drive and maybe
display some status on the monitor. The trick is to use a plain ole VGA card,
NOT PCI. If you don't have a VGA card, you'll have to do this blind. If the
floppy drive exhibits a little bit of activity when you turn on the PC,
that's a pretty good sign that there's a boot-block in effect.

If you wanna give this a try, do this.

Create a bootable floppy and copy the Award flash utility along with a
working BIOS image file.

Next, you'll need to make an autoexec.bat file. Use a text editor and add the
following lines:
@ECHO OFF
AwardFlash.exe biosimage.bin /py

Save it to the floppy as autoexec.bat. One note, you'll obviously need to
change "AwardFlash.exe" to the appropriate name for your Award flash utility.

If that fails...there's ONE last brutal step you can take; Hot swap! That's
for another day =)

Good Luck!

Tim Hamel

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


2001\04\01@171615 by Someone Else

flavicon
face
Thank you very much, I would really appreciate it. I'm using one of those free
e-mail accounts now, so I can't see the mail adress of the originating sender.
But if you can e-mail me at RemoveMEbp19TakeThisOuTspamoperamail.com I would be a very happy
person.  I assume that most likely, they are still using the same kind of
chip.  This software will let me write the .bin bios files that most
motherboard manufacturers release on their webpages? It's very nice to have
found someone who has built one of those devices, as most people misunderstood
me. One guy even mailed me and suggested that the only reason I'd want to do
this is to make a virus, I just don't understand some people's logic.  Please
mail me with some additional information on the writer you made, and how much
all the components cost you, as I am very interested in knowing more.

Regards,
Eivind.

{Quote hidden}

interesting
>>in building this device for approximately the same ammount, at most $35...
>>just hope someone knows how.
>>
>>Eivind.

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestSTOPspamspammitvma.mit.edu


2001\04\01@180037 by Wojciech Zabolotny

flavicon
picon face
On Sun, Apr 01, 2001 at 08:17:43PM +0100, David Stubbs wrote:
> Hi,
>
> Are you the same person who was asking this on IRC in #PIC the other night?
> I don't know much about writing to BIOS except that it is extremely
> dangerous. I don't quite get why you would like to take such a risk just out
> of curiosity. Besides, motherboard manufacturers give away perfectly good
> BIOS flashing tools. The only people I could imagine having an interest in
> this are people writing harmful virus's.
>
> I'm sure you are not trying to do this for illegitimate purposes but I'm
> sure you can see how I could come to this opinion.
>
 I'm sorry, but I can't agree with your opinion. I had to build a modular
controller system using many diskless PC boards - CPC2245 produced by
Advantech. To lower the end price of the solution and to make the management
of the whole system easier, I had to make them net-bootable (the boards AKA
"biscuit PC's" are equipped with NIC, but there is no place net bootrom).
Unfortunately, Advantech didn't provide such functionality in their
standard BIOS. Even worse - the only net-bootable BIOS provided by the
Advantech (which anyway required the BIOS reprogramming) used only the
very old RPL protocol, which was not compatible with Linux DHCP server used
for management of the whole system.
 So the only way to do my job was to prepare the customized BIOS adding muy
own module emulating the additional ISA or PCI BIOS, and reprogramm the
flash.
 So there are really some situations when someone has to reprogram the
flash with BIOS...

 BTW AFAIR the original poster didn't ask how to erase/reprogram the BIOS
in the motherboard (kind of knowledge really "useful" for virus writers),
but how to build the flash programmer...
 BTW 2. It is really easy to fail when upgrading BIOS. Just imagine the
power supply failure in the middle of the process...
--
                               Regards,
                               Wojciech Zabolotny
                               TakeThisOuTwzabTakeThisOuTspamRemoveMEise.pw.edu.pl

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestspamspam.....mitvma.mit.edu


2001\04\01@185544 by Someone Else

flavicon
face
{Quote hidden}

Or a mains fuse blow-out.. like if your washing machine gets switched on by
your mrs, and the fuse blows during bios-flashing.
But like you say: I have NO interest whatsoever in knowing how to erase bios,
I want to know HOW TO BUILD THE PROGRAMMER-device.
I am not into making virii or anything like that, I simply want to build a
device which will let me write the .bin files from the
Abit/Asus/Aopen/whichever pages of bios to the bios chip, since some times I
come across friends on irc or wherever who have messed up their bios-flash
procedure. The reason for wanting to build this, is that when the bios is
non-operational, your motherboard will not power up, and you can not run the
standard bios-flashing program. So I wish to make this externally mounted
serial-port device, and run the writing from another fully functioning pc. I
have had a reply from Sean, saying he had once built such a device, but I have
not yet received any plans relating to this. I am really looking forward to
building the thing, and seeing if it works. His was for 28-series, apparantly
flash-chips come as 28C, 28F, 29C, 29EE, 29F, and are either 5 or 12 volt. I
guess I'll start off with the one from Sean, and sort of take it from there.
If that one works out I might get really addicted to this, and have to build a
whole bunch of them for the different chips. What would be really cool, would
be if someone knew how to make one that'll handle all of the before mentioned
chips, or like one for the 12v ones and one for the 5v ones.
Thank you for any help received, it shall be very appreciated.

Eivind.

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-request.....spam@spam@mitvma.mit.edu


2001\04\01@194424 by Brett Testerman

flavicon
face
What you are trying to do is not all that hard. Most flash devices today (I am
dealing with a 28F800B3B right now myself) don't require special voltages to erase
or program unless you want to do fast production programming (another issue
altogether). It is simply a matter of writing data patterns to the chip in a
specific order and then reading a location until the chip tells you it's done.

What is required is that you need to drive ALL the address lines and ALL the data
lines, which is beyond the capabilities of a PIC. Well, I suppose you could use a
PIC for serial download and then drive some external latches. The data lines would
obviously have to be bidirectional. (hmmmm, 8 I/O's to bus the latches. 4 more for
latch select and 3 or 4 more for the control lines to the flash itself. 2 more for
serial data to the host...18 i/o lines...could be done).

What you need to do is determine the exact type of the chip and then download the
data sheet from the manufacturer. Then you can tell exactly what is needed to
program the chip.

However, how do you justify the 3 or 4 days of effort required to get the all
together just to save a $100-$150 motherboard?

Brett

Someone Else wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-request.....spammitvma.mit.edu


2001\04\01@195041 by Someone Else

flavicon
face
>===== Original Message From pic microcontroller discussion list
<spamPICLISTKILLspamspam@spam@MITVMA.MIT.EDU> =====
>What you are trying to do is not all that hard. Most flash devices today (I
am
>dealing with a 28F800B3B right now myself) don't require special voltages to
erase
>or program unless you want to do fast production programming (another issue
>altogether). It is simply a matter of writing data patterns to the chip in a
>specific order and then reading a location until the chip tells you it's
done.
>
>What is required is that you need to drive ALL the address lines and ALL the
data
>lines, which is beyond the capabilities of a PIC. Well, I suppose you could
use a
>PIC for serial download and then drive some external latches. The data lines
would
>obviously have to be bidirectional. (hmmmm, 8 I/O's to bus the latches. 4
more for
>latch select and 3 or 4 more for the control lines to the flash itself. 2
more for
>serial data to the host...18 i/o lines...could be done).
>
>What you need to do is determine the exact type of the chip and then download
the
>data sheet from the manufacturer. Then you can tell exactly what is needed to
>program the chip.
>
>However, how do you justify the 3 or 4 days of effort required to get the all
>together just to save a $100-$150 motherboard?
>
>Brett

It's not about the money really, it's also a matter of seeing if I can do it.
You seem like a guy who knows a lot about these things, unlike me who has only
just entered this world.  I hope I can learn some as I go along.

Eivind.

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


2001\04\02@090744 by Olin Lathrop

face picon face
> However, how do you justify the 3 or 4 days of effort required to get the
all
> together just to save a $100-$150 motherboard?

Good question since he claims this is for real (time = money) work.  Chances
are he could also buy just the replacement BIOS ROM for about $20.


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

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\02@101159 by Someone Else

flavicon
face
Why hate me so much? So what if I want to do what is in your eyes wasting my
time, what if I have years to waste on whatever? Who are you to judge.

Eivind.

<TakeThisOuTPICLIST@spam@spam@spam@MITVMA.MIT.EDU> =====
{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\02@102850 by Eisermann, Phil [Ridg/CO]

flavicon
face
       Maybe that was in a post I haven't received yet or in a private
mail. But from the posts to the list, it sounds rather like he wants to
learn, as opposed to doing it for real work. A little bit like a hobby. That
would certainly justify the time and expense. So would trying to understand
the process.

>> However, how do you justify the 3 or 4 days of effort required to get the
all
>> together just to save a $100-$150 motherboard?

>Good question since he claims this is for real (time = money) work.
Chances
>are he could also buy just the replacement BIOS ROM for about $20.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\02@114921 by Someone Else

flavicon
face
>===== Original Message From pic microcontroller discussion list
<KILLspamPICLISTKILLspamspamspamBeGoneMITVMA.MIT.EDU> =====
>        Maybe that was in a post I haven't received yet or in a private
>mail. But from the posts to the list, it sounds rather like he wants to
>learn, as opposed to doing it for real work. A little bit like a hobby. That
>would certainly justify the time and expense. So would trying to understand
>the process.

Yes, what you are saying here is very true. Part of the purpouse is seeing if
I can build the device and make it work.  If I just wanted a cheap replacement
chip, I would have bought it already. Also I have no previous experience with
this sort of chip in this context, so for me it would be very much a learning
experience, and that's just it I want to learn something, it's basicly
something genetic, every person has a desire to explore what is new to them,
and some things fascinate them more than other things. And yes, it would be a
hobby-basis. I don't see how someone could assume this would be work-related,
as there's really not any way to make money from something like this.  Plus
I'll probably spend ages building the device, and as such if it was for
business use it would not be very cost-efficiant. My spare time does not cost
me any thing, and I have lots of it.  If it were not for people who were
willing to use their spare time toying around with things, we would not have
the PC as we know it today.

Eivind.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\02@133700 by Dale Botkin

flavicon
face
Besides which, what diference does it make that it's a BIOS?  How about
the guy wants to know how to program FLASH parts.  It's not like he's
asking how to defeat code protection on a PIC or something.  A desire to
learn how to program FLASH devices is not inherently indicative of
anything other a desire to learn how to program FLASH devices.

As for the motherboard question... if I have a motherboard that's
perfectly good except for a blown BIOS, I'll hack on it in my spare time
rather than throw it out.  A hundred bucks may not be a big deal to
someone who is trading expensve consulting time for it, but if you're a
hobbyist it's a big old pile of money out of what is probably a
near-nonexistant hobby "budget".  Speaking as a person with five kids --
two in college -- I can tell you a motherboard can be a major expense.  I
also just hate throwing out something perfectly good just because I don't
know how to fix it.  Does that sound like such a terrible thing?

Sheesh, give the guy a break.

Dale

On Mon, 2 Apr 2001, Eisermann, Phil [Ridg/CO] wrote:

{Quote hidden}

---
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
               -- Isaac Asimov

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\02@214722 by Someone Else

flavicon
face
>===== Original Message From pic microcontroller discussion list
<spamBeGonePICLISTKILLspamspamMITVMA.MIT.EDU> =====
>Besides which, what diference does it make that it's a BIOS?  How about
>the guy wants to know how to program FLASH parts.  It's not like he's
>asking how to defeat code protection on a PIC or something.  A desire to
>learn how to program FLASH devices is not inherently indicative of
>anything other a desire to learn how to program FLASH devices.
>
>As for the motherboard question... if I have a motherboard that's
>perfectly good except for a blown BIOS, I'll hack on it in my spare time
>rather than throw it out.  A hundred bucks may not be a big deal to
>someone who is trading expensve consulting time for it, but if you're a
>hobbyist it's a big old pile of money out of what is probably a
>near-nonexistant hobby "budget".  Speaking as a person with five kids --
>two in college -- I can tell you a motherboard can be a major expense.  I
>also just hate throwing out something perfectly good just because I don't
>know how to fix it.  Does that sound like such a terrible thing?
>
>Sheesh, give the guy a break.
>
>Dale

Thanks, it's nice that someone understands my point of view here, I was
getting kind of depressed over all the stick I was getting. I thought I asked
a reasonable question, and that this was a list where people could answer this
sort of thing, but it seems like everyone is very busy protecting their
"secrets", and very concentrated on not letting me know anything. However, one
person has helped me and for that I am very grateful thank you. However, I
could still use a little more help, if anyone has knowledge in this field
they'd be willing to share with me, I would be very grateful. Basicly I don't
know the first thing about this, I've never built a pic-programmer or anything
like it, I can just barely figure out how to interpret the plans for it and
stuff like that. (go ahead poke fun at me.)
I'm 21 years old and a student with a part-time job, so I have lots of free
time, and to me Money does matter, I earn like $250/month, and most of my
friends are in the same position. I can see how for a grown man with a good
job earning tons of money this can be hard to understand.

Regards,
Eivind.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\02@233844 by Dale Botkin

flavicon
face
I suspect the programming method may depend on the manufacturer and type
of device.  For example, I found documentation on Intel's site for their
FLASH memory devices that explains in great detail how to write, erase,
read, etc. from the device.  Right out there in the open, where anyone can
see it!! ;-)  You'll have to see who manufactured your FLASH device, then
check the manufacturer's web site for the data sheet or other
documentation that will detail how to erase & program the chip.

Dale

On Mon, 2 Apr 2001, Someone Else wrote:

{Quote hidden}

---
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
               -- Isaac Asimov

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads



'[PICLIST] [PIC] Writing to PORTC while using seria'
2001\08\04@094836 by Andy Meng
picon face
Hello,

I am working on an LCD (HD44780) driver that I can use in future programs.
by more or less pasting it in. I am using 4-bit mode and the E and RS pins,
so it only takes six pins to interface to it. Right now I have the 4 data
lines on the upper 4 bits of PORTB (I'm using a 16F872 but am going to
switch it to an 'F873 soon). I want to put the control lines on the same
port so that it is easier to use the other ports. Would the easiest way to
do this be to read the current PORTB values, IOR them with the 4 data bits
to be sent to the LCD and then stick it back in PORTB? What about putting
the 4 bits in w and then doing IORWF  PORTB,w then move w to PORTB? Is there
a preferred method?

The second part of the question has to do with the USART on the 'F873. I
want to put the LCD lines on the lower part of PORTC while using the 2 upper
pins for serial communication (using the USART). Will the operation of the
USART be affected in either receive or transmit if I read and write to all
of PORTC? If so, what can be done to read and write the rest of PORTC while
using the USART?

Thanks in advance,
Andy N8MX
http://www.qsl.net/n8mx


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestRemoveMEspam@spam@mitvma.mit.edu


'[PIC]:trouble writing to eeprom on 16f628'
2001\08\13@155921 by PD

flavicon
face
I have followed the Microchip examples and still can't get this to work, I can read from the eeprom with no problems but can not get it to write. I created a routine to read some values from the eeprom to the RAM at the start of the program and then if the user changes any values during use they are  then written from RAM to the eeprom. If I simulate it in MPLAB it works fine, I can provide examples of my code if that helps any.

Thanks Chris

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


2001\08\14@123740 by PD

flavicon
face
Has anyone seen any examples that shows a routine to write multiple ram locations to the eeprom, it would help me greatly.

Thanks for any ideas on this.

Chris   {Original Message removed}

2001\08\14@140515 by Heinz Czychun

flavicon
face
Hi Chris,

       I don't have any code, but have you checked the EEPROM
protect bit ( Bit 8 should be 1 ) in the config word?

Heinz

At 12:39 PM -0700 8/14/01, PD wrote:
>Has anyone seen any examples that shows a routine to write multiple
>ram locations to the eeprom, it would help me greatly.
>
>Thanks for any ideas on this.
>
>Chris
>   {Original Message removed}

2001\08\14@144004 by PD

flavicon
face
Thanks for your reply, I can't seem to find any reference to this in the
data sheets, all I can see is the write enable bit in a data register, but
nothing mentioned in the config word. Could you give me an example of the
config word that I should use, I use mplab so I normally don't even use a
config word, this could be my problem right there.
{Original Message removed}

2001\08\14@151151 by Bob Barr

picon face
PD wrote:
>
>Thanks for your reply, I can't seem to find any reference to this in the
>data sheets, all I can see is the write enable bit in a data register, but
>nothing mentioned in the config word. Could you give me an example of the
>config word that I should use, I use mplab so I normally don't even use a
>config word, this could be my problem right there.


Even when using MPLAB, specifying the CONFIG fuses directly in your source
code provides a few advantages to letting MPLAB set them for you.


Not in any particular order:

1. Your selections are used, not MPLAB's defaults. You're guaranteed to get
what you expect.

2. For some of your programs you may want to use different options than for
other programs. By specifying the fuses in the source code, you don't have
to remember to change the default MPLAB settings before programming. (It's
just too easy to forget to do that.)

3. Your selections provide documentation right in the code as to how *you*
want the CONFIG fuses to control processor operation. (All of the fuse
options are defined in the standard Microchip include files so they're
fairly easy to interpret.)

Regards, Bob



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: To leave the PICList
STOPspampiclist-unsubscribe-request.....spammitvma.mit.edu


2001\08\14@153822 by iklas Wennerstrand

picon face
A possible solution to your problem with EEmemory  is that there is a
printing error in the 16F628 data sheet.
The instruction on how to read and write to the internal Eememory is copyed
and pasted from the PIC16F84 data sheet. And therby you write to the wrong
bank in 16F628. Eeread and Eeaddress is shifted from a F84. Have a look at
the memory SFR table in the 16F628 data sheet and you see what I mean. I
think there is an errata where this printing error is documented. Look at
http://www.microchip.com under literature and errata document.

Niklas Wennerstrand

-----Ursprungligt meddelande-----
Från: pic microcontroller discussion list [spamBeGonePICLISTRemoveMEspamRemoveMEMITVMA.MIT.EDU]
För PD
Skickat:        den 14 augusti 2001 23:42
Till:   @spam@PICLISTspamBeGonespamMITVMA.MIT.EDU
Ämne: Re: [PIC]:trouble writing to eeprom on 16f628

Thanks for your reply, I can't seem to find any reference to this in the
data sheets, all I can see is the write enable bit in a data register, but
nothing mentioned in the config word. Could you give me an example of the
config word that I should use, I use mplab so I normally don't even use a
config word, this could be my problem right there.
{Original Message removed}

2001\08\14@163821 by PD

flavicon
face
Ok I checked out that info, thanks, I also found that bank problem while
simulating in mplab, I wondered why that was.
I looked over the new data and see that to set write enable they are setting
EECON, WREN is this right? I thought it should be EECON1, WREN i included
the section from the data sheet, the other thing that gets me with this is
they use 0AAh, the compiler doesn't like this, I have been using 0xAA, is
that all right? Other then that I use much the same code, is it OK to load
the data into EEDATA before the address value into EEADR, because thats
something else that I have done differently. This problem is driving me
nuts, thanks for the help.

EXAMPLE 13-2: DATA EEPROM WRITE
; set up the data and
the address
BSF STATUS, RP0 ; Bank 1
MOVLW CONFIG_ADDR ;
MOVWF EEADR ; Address to write
MOVLW CONFIG_DATA ;
MOVWF EEDATA ; Data to write
; perform the write
operation
BSF EECON, WREN ; Enable Write
BCF INTCON, GIE ; Disable INTs
MOVLW 055h ;
MOVWF EECON2 ; Write 55
MOVLW 0AAh ;
MOVWF EECON2 ; Write AA
BSF EECON1, WR ; Set WR bit
BCF STATUS, RP0 ; Bank 0

{Original Message removed}

2001\08\14@185919 by Tony Nixon

flavicon
picon face
PD wrote:
>
> Has anyone seen any examples that shows a routine to write multiple ram locations to the eeprom, it would help me greatly.


This may help...


; WRITE EEPROM EXAMPLE

       movlw 0x00              ; set EEPROM address = 0
       bsf STATUS,RP0          ; RAM Page 1
       movwf EEADR
       movlw 0x22
       call WrtEep             ; write 0x22 to EEPROM address 0h

       movlw 0x33
       call WrtEep             ; write 0x33 to EEPROM address 1h

       ....

; READ EEPROM EXAMPLE

       movlw 0x00              ; set EEPROM address = 0
       bsf STATUS,RP0
       movwf EEADR
       bcf STATUS,RP0
       call RdEep              ; read EEPROM address 0x00 = 0x22
       movwf Temp1

       call RdEep              ; read EEPROM address 0x01 = 0x33
       movwf Temp2

       ....

;
; -----------------------------
; WRITE AN INTERNAL EEPROM BYTE
; -----------------------------
; EEADRH/EEADR set before entry
; Data to store is in W on entry
;
WrtEep  bsf STATUS,RP0          ; RAM Page 1
       movwf EEDATA
       bsf EECON1,WREN
       movlw 55h
       movwf EECON2
       movlw 0xAA
       movwf EECON2
       bsf EECON1,WR
WrtLoop nop
       btfsc EECON1,WR
       goto WrtLoop

       incf EEADR              ; automatic EEADR increment
       bcf EECON1,WREN
       bcf STATUS,RP0          ; RAM Page 0
       return
;
; ----------------------------
; READ AN INTERNAL EEPROM BYTE
; ----------------------------
; Result is in W
;
RdEep   bsf STATUS,RP0          ; RAM Page 1
       bsf EECON1,RD           ; read back ROM location
       nop                     ; in case internal ROM reading
       nop
       incf EEADR              ; automatic EEADR increment
       movf EEDATA,W
       bcf STATUS,RP0          ; RAM Page 0
       return

--
Best regards

Tony

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

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


2001\08\14@203147 by PD

flavicon
face
Tony,
   THANK YOU, it is now working fine, you should send your examples to
Microchip so that it can be printed as real working code!

Thanks again
Chris
{Original Message removed}

2001\08\14@214250 by Heinz Czychun

flavicon
face
Hi Chris,
       Sounds like you solved your problem, Great !

       In answer to your question about where to find info on config bits.
       Checkout the 'F62x Data sheet, 40300b.pdf page 96 for the
config word info.

 Can be found at;

http://www.microchip.com/14010/lit/pline/picmicro/families/16c62x/devices/16c628/40300/

       In retrospect, what lead me to believe the code protect bit
was not the problem is this on page 93 of the document indicated
above;

" 13.7 DATA EEPROM OPERATION DURING CODE PROTECT

When the device is code protected, the CPU is able to read and write
unscrambled data to the Data
EEPROM. "

       This seems to indicate that the data protect bit is for
external reads only and lets the CPU read/write data eeprom.


This also is a worth while document;

       The Mid Range Reference manual, 33023a.pdf, page 117 for info
on reading and writing the data eeprom. Can be found at;

http://www.microchip.com/10/lit/pline/picmicro/refernce/midrange/33023a/


Heinz

At 2:41 PM -0700 8/14/01, PD wrote:
>Thanks for your reply, I can't seem to find any reference to this in the
>data sheets, all I can see is the write enable bit in a data register, but
>nothing mentioned in the config word. Could you give me an example of the
>config word that I should use, I use mplab so I normally don't even use a
>config word, this could be my problem right there.

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



'[PIC]: Writing hexfile to pic'
2001\10\17@074309 by 1?Q?Benjamin_Menk=FCc?=
flavicon
face
:04420000112233440F

:04020000112233444F

:00000001FF

this is my test-hex-file

it should write 0x2211 and 0x4433 into the EEPROM
and 0x2211 and 0x4433 to 0x100 prog-mem.

The results I get when I write it are weird. in the eeprom I find 0x1133 ('22' and '44' missing)

and at 0x100 0x2211 and 0x0433 (this is almost right just one '4' is missing)

During flashing with bootloader I get also an error...
when I take a "normal hex file" i don't get any error and i can find the stuff inside the pic.

regards,

BEN


--------------------------
Benjamin Menküc
Auto-Intern GmbH
Haberlandstr. 125
44359 Dortmund
Tel: 0231-1893070
Fax: 0231-93699548
http://www.auto-intern.com


Meinen PGP-Schlüssel kann man unter:

http://www.auto-intern.com/php/pgp_menkuec.php

finden.

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


2001\10\17@102207 by Karl Seibert

flavicon
face
Which PIC are you using?

I can't explain the EEPROM problem.  Maybe someone else can
understand what is happening.

The program memory problem makes it look like you are using
a PIC with a 14 bit word for instructions.
0x2211 & 0x3FFF (14 bit mask) = 0x2211
0x4433 & 0x3FFF = 0x0433.  The top two bits are not
stored because only 14 bits are used in the instruction.

Also, it looks like your checksums are wrong.  If you
add up the bytes, the totals have a least significant
byte of 0xFF instead of 0xFF.  The checksums for the
first two lines should be 10 and 50.  The last line
looks right.

Karl


Quoting Benjamin Menk|c <spamBeGonebenjaminspamAUTO-INTERN.COM>:

{Quote hidden}

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


2001\10\17@103344 by 1?Q?Benjamin_Menk=FCc?=

flavicon
face
I already figured that problem....

Somehow it works now....

4 bytes was not a valid length i guess... I changed it and it worked... 2
and 6 works...


regards,

BEN

{Original Message removed}

2001\10\17@103835 by Karl Seibert

flavicon
face
The spirit is willing but the fingers are weak.

Quoting Karl Seibert <spamkarlseibertspamSISCOM.NET>:
> Also, it looks like your checksums are wrong.  If you
> add up the bytes, the totals have a least significant
> byte of 0xFF instead of 0xFF.  The checksums for the

should be "least significant byte of 0x00 instead of 0xFF"

> first two lines should be 10 and 50.  The last line
> looks right.
>

Karl

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



'[PIC]: macro writing'
2002\01\28@033530 by Andrei B.
picon face
Hi!

How can I write the following code in a macro :

----------
#DEFINE pin0 PORTB, 0

bcf pin0
----------

Writing :

macro0 MACRO what_pin
bcf what_pin
ENDM

and then using
#DEFINE pin0 PORTB, 0


macro0 pin0

will give me an error by the assembler :
Symbol not previously defined (what_pin)

I'm trying to build a more flexible serial routine in a macro and I'm
stuck with this trying to specify it as parameter what pin from what
port is the RX input.


=====
ing. Andrei Boros
Centrul pt. Tehnologia Informatiei
Societatea Romana de Radiodifuziune

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.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


2002\01\28@095039 by Al Williams

flavicon
face
The problem here is that the DEFINE does a text substitution. So when
you write:

       macro0 pin0

You are getting:

       macro0 PORTB,0

That's two arguments and confuses the assembler. Try this:

#define pin0 PORTB,0

macro0 MACRO port,pin
      bcf port,pin
        ENDM

. . .

       macro0 pin0

Good luck!

Al Williams
AWC
* PIC Tutorial at http://www.al-williams.com/pictutor



> {Original Message removed}


'[OT]: writing a contract'
2002\03\25@212050 by David Koski
flavicon
face
I will be developing some PIC code for a small project under contract on an
hourly basis.  The company has expressed concern with my retaining copyright.  I
think the real concern is about me producing a competetive product on my own,
although I have no interest in that.  I am looking for example contracts that I
can draw from.

Best Regards,
David Koski
EraseMEdavidspamBeGonespamspamKosmosIsland.com

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


2002\03\25@230719 by Jinx

face picon face
> I will be developing some PIC code for a small project under
> contract on an hourly basis.  The company has expressed
> concern with my retaining copyright.  I think the real concern
> is about me producing a competetive product on my own,

Just my $0.02 from previous work

Whatever you are paid for a job, you always retain copyright
unless you sign it away. You can also sign a non-disclosure
agreement or similar, which will preclude you from poaching
their idea (it's their idea I presume) and making a competitive
product

As a contractor, with no interest in their final product, you are
entitled to no more payment than what you are paid on the
hourly basis. However, that doesn't settle the issue of copyright.
If they won't buy it or you won't sell it, then it's stalemate and
they'll go somewhere else

Just be careful. I've had a couple of clients go very "funny"
when copyright ownership was brought up. It worked out in
the end, but the initial shock of being told that they do not own
what they paid for made for tense conversations, and there's
always a feeling of mistrust. Keep it friendly, business-like
and non-threatening and you should be OK, but make sure
it gets settled now

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


2002\03\26@010748 by David Koski

flavicon
face
On Tue, 26 Mar 2002 16:04:31 +1200
Jinx <KILLspamjoecolquittspamCLEAR.NET.NZ> wrote:

{Quote hidden}

The compensation is (xx per hour) is spelled out and I have made it clear that I
will own the copyright and why.  I am looking for a way to say, "you can use the
source code for your own benefit but you will not let it get out of your hands
except for someone else developing it for you.  Furthermore, I agree not to
disclose your idea or to compete with you by producing a like product."
However, there really is little to disclose on my part though as it is so simple
in concept and implementation.

Regards,
David Koski
davidspam_OUTspamspamKosmosIsland.com

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


2002\03\26@021152 by Jinx

face picon face
> I am looking for a way to say,

Why not just say what needs saying in plain English ? It
doesn't have to be in legalese, as long as it's unambiguous,
clear and agreed to by all parties. Just think of the scenarios
and possibilities and cover them

> "you can use the source code for your own benefit but you
> will not let it get out of your hands except for someone else
> developing it for you"

Do you mean that they are not to publish or otherwise put your
code into the public domain ? If so, I'm not sure if you can have
two bites of the cherry - either you own the copyright or you
don't. If you don't then you'll have no say in what they do with it

The two sides appear to be at odds, but with similar concerns.
They don't want you poaching their idea, you don't want them
poaching your code. Perhaps you can trade concerns - give
them the copyright if they agree not to let it out of their hands
except to another developer

I don't know if this applies in your case, but a problem with
getting companies to sign what seems tantamount to a non-
disclosure of your making is that executives will not take
responsibility for the actions of their staff or agents, and thus
not sign. Many companies of course have a reputation to
protect, and in that regards they are trustworthy (-ish), and
you have no choice when approaching large players but to
trust them

> However, there really is little to disclose on my part though
> as it is so simple in concept and implementation

They'll be looking at it from a principle point of view, rather
than the magnitude of the product

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


2002\03\26@044742 by Alan B. Pearce

face picon face
>I've had a couple of clients go very "funny"
>when copyright ownership was brought up. It worked out in
>the end, but the initial shock of being told that they
>do not own what they paid for

Surely if they commissioned the work, and paid for it they own the
copyright?

If not could not they have this as part of the contract?

Is this a "peculiarity" of copyright in the USA?

If I work as an employee for a company then I have always worked under a
contract of employment that specifically states that the company owns the
copyright of any such work I do.

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


2002\03\26@052034 by michael brown

flavicon
face
>  I am looking for a way to say, "you can use the
> source code for your own benefit but you will not let it get out of your
hands
> except for someone else developing it for you.  Furthermore, I agree not
to
> disclose your idea or to compete with you by producing a like product."
> However, there really is little to disclose on my part though as it is so
simple
> in concept and implementation.
> David Koski

David,

!!! WARNING !!!  I Am Not A Lawyer  !!! WARNING !!!

IIRC that does sound something like "limited exclusive use"  I got this from
a free-lance photography book, of all things.  But copyrights is copyrights.
;-)

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


2002\03\26@053737 by Pic Dude

flavicon
face
Generally, working for a company, they have you sign statements up front
stating that they own copyrights & patents for anything that you develop
and invent that has anything to do with the company.  If you use a pencil
that you borrowed from the company, and used it to write down some
ideas for the invention at a bar on a napkin, they own it.  A lot of
companies also state that as long as you are employed with them, no
matter whose tools you use, they own anything you develop/invent.
However, that last part has been disputed by many (as I understand it).

For consulting work, I've found in my experiences that nothing is
standard.  It's whatever you and the client are willing to agree to.  The
key here is to make sure that all possibilities that anyone can think of
are brought up, discussed, and agreed to and then documented in the
contract.  The contract should also state the procedures for mediation
should something later arise and was not specified in the document.

Plain English works very well, but some clients tend not to think of a
consultant as very professional if the documents are not in some form
of legal jargon.  (Doesn't have to be confusing though).  Just write in
"professional" English (whatever that really is) and be explicit and
detailed, and you should be okay.

Cheers,
-Neil.


{Original Message removed}

2002\03\26@055856 by Jinx

face picon face
> Surely if they commissioned the work, and paid for it they
> own the copyright?

I don't believe that's the case. As I mentioned, a couple of
clients got a little disturbed by finding out they own just the
physical material or firmware, not the IP

> If not could not they have this as part of the contract?

Yes. And it doesn't have to be sold, you can just give it up.
Normally I think you would, to avoid confrontations that may
be unnecessary. The other aspect to consider is that a deal
could be done to become a supplier. Rather than hand the
source code over, offer to supply pre-programmed protected
PICs under an exclusivity arrangement

> Is this a "peculiarity" of copyright in the USA?

Doesn't authorship confer copyright everwhere ?

> If I work as an employee for a company then I have
> always worked under a contract of employment that
> specifically states that the company owns the copyright
> of any such work I do

I nearly mentioned that in the previous reply, but David
appears to be a contractor. As an employee, the company
would own anything you create unless otherwise agreed

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


2002\03\26@072259 by Bob Ammerman

picon face
What you are saying, in sorta legal terms:

1. You are giving them a non-exclusive source-code license.

2. You are make a non-compete promise to them.

Bob Ammerman
RAm Systems


{Original Message removed}

2002\03\26@091104 by M. Adam Davis

flavicon
face
I know that copyright law is a very deep subject, but I'm curiouc -
couldn't the source code be considered part of their IP, or at minimum a
company asset?  If so, couldn't they sell or license it just like any
other IP or asset?

How does(or is) that affected by you retaining copyright?  Are you
simply granting them and exclusive, perpetual license to use and
duplicate the code?

I've heard of programmers retaining copyright/ownership to portions or
algorithms developed (which may or may not reside in a seperate library
or file) but I hadn't considered the idea of retaining complete copyright.

-Adam

David Koski wrote:

{Quote hidden}

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


2002\03\26@091118 by Rick C.

flavicon
face
Pic Dude wrote:

>  copyrights & patents for anything that you develop
> and invent that has anything to do with the company.  If you use a pencil
> that you borrowed from the company, and used it to write down some
> ideas for the invention at a bar on a napkin, they own it.

Here's one (contract) that I was forced to sign. If I went home and worked on
any
software or designed and hardware for myself on my own time, the company owned
it too!

>  A lot of
> companies also state that as long as you are employed with them, no
> matter whose tools you use, they own anything you develop/invent.

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


2002\03\26@094003 by michael brown

flavicon
face
>
> >  copyrights & patents for anything that you develop
> > and invent that has anything to do with the company.  If you use a
pencil
> > that you borrowed from the company, and used it to write down some
> > ideas for the invention at a bar on a napkin, they own it.

> Pic Dude responds:
>
> Here's one (contract) that I was forced to sign. If I went home and worked
on
> any
> software or designed and hardware for myself on my own time, the company
owned
> it too!

I AM NOT A LAWYER (but it doesn't stop me from speaking my mind)

I wonder if that would really hold up in court.  Copyright laws tend to be
somewhat protective of the owner (e.g. you can't lose the rights to
something you created without physically signing something, or in the case
of photography, you own the rights as soon as the shutter closes).  I would
think that a corporation would be hard-pressed to prove that they owned (or
even had a legal claim to) your personal time and creativity.  I worked for
a small software company for over ten years and they never had any of us
sign any kind of copyright waiver.  AFAIK, I would be well within my rights
to patent or otherwise resell anything I created while working there.  Since
there was no contract of any type, they would be left with the burden of
proving that I was even paid to write software for them.  Of course, I have
no intentions of doing any such thing, but they really should have
considered the ramifications of what they were doing.

Unless you sign a waiver, you own the copyright.  They way I understand it,
there is no "implied" transfer of a copyright.  If someone gives you a
camera, film and $50.00 to take pictures for them, you still own the full
rights to the pictures unless you "sign" them away.  They have no claim
based on their ownership of the materials.  By inductive reasoning, it
stands to reason that the same rules apply to software that apply to
photographs or books.

Flame shields ready

michael brown

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


2002\03\26@095524 by Dale Botkin

flavicon
face
If you're in the US, you can get some pretty detailed explanations
directly from the source:

http://www.loc.gov/copyright/circs/circ1.html

I know that's where I went to get information.

Dale
--
"Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only the cat died nobly."
         - Arnold Edinborough

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


2002\03\26@100026 by Micro Eng

picon face
Work I am doing now for one place...basically says, don't go and use the
stuff you do for me and do the same thing for someone else but your free to
use whatever you develop (techniques, routines,etc) for anything else.  I
mean, come on, why would a place pay money for work done and then allow the
same product to be built by someone else as well?

OK...so wonder what others charge per hour for PIC codin?


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

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


2002\03\26@100237 by Micro Eng

picon face
The place I work for...I spelled out exactly what I was doing outside the
company and had it excluded from that type of agreement.

{Quote hidden}

>{Original Message removed}

2002\03\26@111743 by Pic Dude

flavicon
face
From the perspective of an e-commerce consultant, the contracts generally
state that we WILL be doing this for others, since this is our business.  It
should state that explicitly, since this is the company's livelyhood.  Even
if
we pull out parts of the code we custom wrote for a client and make into a
product or package that we then custom-fit into their competitor's site,
that
should be okay.  But directly unplugging the code from customer A's site
and plugging it into customer B's site is a not good.  The look, feel and
workflow should be different.  The engine functionality and bottom-line
purpose/feature can be the same. First-to-market is a big factor,
preventing a competitor from having it is not, since the competitor will
eventually see it and have some other consultant develop it.

I worked with one company that actually discussed the legalese in detail.
Since they knew that their competitors could get another firm to duplicate
the functionality on their own sites, they allowed us to leave those
conditions in the contract and used is as a leverage point to win some
other points.

Cheers.


{Original Message removed}

2002\03\26@112003 by Pic Dude

flavicon
face
Yes, I do that as well all the time.  However, this is good only for
ideas you have before you start working for a company.


{Original Message removed}

2002\03\26@123440 by timknights

flavicon
face
Hello all,

If anybody wants to peruse some legalese, please find below an extract from
a contract I had with a company, which was drawn up (mainly by their
lawyers) when I moved from working as a consultant to an employee for a
couple of years (ironically to simplify some of these issues!). While mainly
for the commercial protection of the company, the contract specifically
identifies the circumstances where IP may be ajudged not be the property of
the company (13(c)(i)) and the identifies the release concession 13(c)(ii).

All in all this contract took nearly 2 years to produce, with inputs from
lawyers on both sides and a lot of meetings and reviews (and of course a lot
of cash for the lawyers). However, an initially indecipherable contract of
about 40 pages was eventually reduced to about 15 pages and I gave up and
signed.

The company was from the US, the contract was drawn up in the UK. I have
since moved on, and its interesting to note that even with such a contract,
as the named "inventor" of some of the IP/patents which resulted, they still
have to come and find me to sign patent releases and documentation from time
to time.

Although nobody involved ever had any real intention of exploiting the other
party, in the modern world of business and law, its increasingly important
to tie up the rights and limits of agreements as clearly and far-reachingly
as possible. Oh for the simplicity of the off-the-shelf end user software
license!

Hope this is of interest,

Tim Knights
@spam@essdRemoveMEspambtinternet.com
embedded systems designer
Electronic Software Systems Design
Norwich. UK


---------------
13. COMPETITION. SECRECY. INVENTIONS - INTELLECTUAL PROPERTY

(a) You will not during your employment be engaged, concerned or interested
directly or indirectly and whether on your own behalf or on behalf of any
other person, firm or company in any trade or business which is, directly or
indirectly, competitive with that of the Company without the prior written
consent of the Chairman of the Company (save that you may hold not more than
5% of the shares or securities issued in any class by a company quoted on a
recognised stock exchange).

(b) i) The Employee acknowledges that in the course of his employment he
will have access to and be entrusted with information in respect of the
business and financing of the Employer and its dealings, transactions,
affairs, plans and proposals all of which information is or may be secret or
confidential and important to the Employer. In this agreement this
information is called "Confidential Information" and includes, without
limitation, confidential or secret information relating to.... (description
of the business and its processes, customers, customers contacts, sales,
margins etc.)

(ii) The Employee acknowledges that the disclosure of Confidential
Information (whether directly or indirectly) to actual or potential
competitors of the Company would place it at a competitive disadvantage and
would do damage (whether financial or otherwise) to its business. He
therefore agrees to enter into the restrictions contained in clause (iii).

(iii) The Employee shall not without the prior written consent of the Board
other than in the proper performance of his duties either during his
employment or at any time after termination:

- disclose to any person (except to those authorised by the Employer to
know); or

- use for his own purposes or for any purposes other than those of the
Employer; or

- through any failure to exercise all due care and diligence,

cause or permit any unauthorised disclosure of any Confidential Information,
save that these restrictions shall cease to apply to information which
(otherwise than through the fault of the Employee) becomes available to the
public generally.

(iv) The parties agree that each of the restrictions set out in paragraphs
(i), (ii) and (iii) and each of the categories of Confidential Information
set out in paragraph (i) inclusive are separate and separable and
enforceable accordingly and if any one or more of such restrictions or part
of such a restriction or categories or part of such categories is held to be
against public interest or unlawful or in any way an unreasonable
restrictive trade, the remaining restrictions or remaining part of the
restriction or the remaining categories or the remaining part of the
category shall continue in full force and effect.

(c) i) If at any time during his employment the Employee (whether alone or
jointly with another) makes or discovers any invention, development,
discovery, improvement or process, whether or not relating directly or
indirectly to the Employer, the Employee shall treat it and all information
relating to it as confidential to the Employer and shall promptly disclose
to the Managing Director of the Employer or in his absence the Chairman or
Secretary of the Employer full details including drawings and notes (if any)
of it to enable to the Employer to determine whether or not it is a Company
Invention. If it is not a Company Invention the Company shall treat all
information disclosed to it by the Employee as confidential information and
the property of the Employee. If it is a Company Invention sub paragraph (v)
shall apply.

(ii) However, the employer agrees to waive all claim (as identified in
paragraph above) both wholly and exclusively outside of the employees
activities of employment under this agreement, and are wholly unconnected
with the employers normal trading activities.

(iii) The employer accepts that the employee may enter into or be party to
agreements of non-disclosure with other companies or individuals where such
companies and individuals are involved in business activities wholly
unconnected with the employers business activities, and with the provision
that any foreseeable conflict of interest arising shall be promptly
disclosed to the employer. Further the employer accepts that the employee
may have an involvement in the generation of copyright or design works or
inventions and patents under these agreements to which all claim shall lie
specifically with the parties identified with those agreements and to which
the employer shall have no claim or interest whatsoever.

(iv) The Employee hereby irrevocably and unconditionally waives in favour of
the Employer all moral rights conferred on him by Chapter IV of Part I of
the Copyright Designs and Patent Act 1988 for any design or copyright work
in which copyright is vested in the Company.

(v) Not withstanding any prior termination of the employment of the Employee
under this agreement at the request and the expense of the Employer the
Employee will do all things necessary or desirable to enable the Employer or
its nominee to confirm absolute title to and ownership of and to obtain the
benefit of the Company Invention, design or copyright work (as the case may
be) and to secure patent or other appropriate forms of protection for it
throughout the world and shall provide to the Employer all such assistance
as the Employer may require in relation to the resolution of any questions
concerning patent copyright or other intellectual property or proprietary
rights assigned by virtue of this paragraph 14(c).

(vi) The Employee irrevocably appoints the Employer to be his attorney in
his name and on his behalf to execute, sign and do all such deeds
instruments or things and generally to use the Employee's name for the
purpose of giving to the Employer or its nominee the full benefits of the
provision of sub paragraph (v) and a certificate in writing signed by any
director or the secretary of the Employer that any instrument or act falls
within the authority conferred by this clause 14 (c) shall be conclusive
evidence that such is the case so far as any third party is concerned.

(vii) Company Invention means any improvement invention development
discovery or process made or discovered by the Employee which (applying the
provisions of Sections 39 and 43 (1), (2) and (3) of the Patents Act 1977 in
the determination of ownership for Patents and other intellectual property
rights) is the property of the Employer.

14. RESTRICTIONS

a) The employee undertakes with the Employer that he will not without the
prior written consent of the Employer either directly or indirectly whether
alone or in conjunction with or on behalf of any other business concern or
person or whether as principal shareholder, director, employee, agent,
consultant, partner or otherwise:

(i) For a period of one year immediately following the date of termination
of the Employee's employment canvass, solicit or approach or cause to be
canvassed, solicited or approached for orders any person who at any time
during the 12 months immediately preceding the date of termination is or
was:

- negotiating with the Employer for the supply of goods and services; or

- a client or customer of the Employer; or

- in the habit of dealing with the Employer

where the orders relate to goods and/or services which are competitive with
or of the types supplied by the Employer at the time of the termination of
the Employees employment and where the Employee or one of his subordinates
dealt or had contact with that person.

(ii) For a period of one year immediately following the date of termination
of the Employee's employment, deal or contract with any person who at any
time during the 12 months immediately preceding the date of termination is
or was:

- negotiating with the Employer for the supply of goods and services; a
client or customer of the Employer; or

- in the habit of dealing with the Employer

where the orders relate to goods and/or services which are competitive with
or of the types supplied by the Employer at the time of the termination of
the Employees employment and where the Employee or one of his subordinates
dealt or had contact with that person.

(iii) For a period of one year immediately following the date of termination
of the Employees employment interfere or seek to interfere with the
continuance of supplies to the Employer from any supplier who has been
supplying goods and/or services to the Employer at any time during the 12
months immediately preceding the date of termination if such interference
causes or would cause that supplier to cease supplying or materially to
reduce its supply of those goods and/or services to the Employer.

(iv) For a period of 6 months immediately following the date of termination
of the Employees employment solicit or entice or endeavour to solicit or
entice away from the Employer or employ any person employed in managerial,
technical sales or marketing capacity by, or who is a consultant to, the
Employer in such a capacity to the Employer at the date of termination or at
any time during the 12 months preceding the date of termination

---------------

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


2002\03\26@132220 by Pic Dude

flavicon
face
On a lighter note, here's some legalese that I remembered from a long
time ago.  Can't remember the source though.

"Insofar as manifestations of physical deficiencies are imperceivable
and are so stipulated, it is incumbent upon said heretofore mentioned
parties to excercise the deferment of otherwise pertinent maintenance
procedures."

In other words...

"If it ain't broke, don't fix it."

Cheers,
-Neil.


{Original Message removed}

2002\03\26@152103 by Jinx

face picon face
> The compensation is (xx per hour) is spelled out and I
> have made it clear that I will own the copyright and why

What would you do if you made an improvement to their
hardware ? I presume you have some or all details of the
circuitry you're interfacing to. You might suggest "the circuit
would work better or the PIC would perform better if you
did this or that". It could happen. You've now got a stake
in the product above and beyond the call of duty as a s/w
contractor. Would you sign that away, ask for a royalty or
extra pay or what ?

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


2002\03\26@160858 by David Koski

flavicon
face
On Wed, 27 Mar 2002 08:19:15 +1200
Jinx <RemoveMEjoecolquittspam.....CLEAR.NET.NZ> wrote:

> > The compensation is (xx per hour) is spelled out and I
> > have made it clear that I will own the copyright and why
>
> What would you do if you made an improvement to their
> hardware ? I presume you have some or all details of the
> circuitry you're interfacing to. You might suggest "the circuit
> would work better or the PIC would perform better if you
> did this or that". It could happen. You've now got a stake
> in the product above and beyond the call of duty as a s/w
> contractor. Would you sign that away, ask for a royalty or
> extra pay or what ?

I am designing the hardware as well.  As per above, I would be compensated for
my time.

David

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


2002\03\26@162641 by David Koski

flavicon
face
On Tue, 26 Mar 2002 18:53:55 +1200
Jinx <joecolquittTakeThisOuTspamCLEAR.NET.NZ> wrote:

<snip>

> > "you can use the source code for your own benefit but you
> > will not let it get out of your hands except for someone else
> > developing it for you"
>
> Do you mean that they are not to publish or otherwise put your
> code into the public domain ? If so, I'm not sure if you can have
> two bites of the cherry - either you own the copyright or you
> don't. If you don't then you'll have no say in what they do with it

I must be missing something.  I wish to retain copyright, but give them
non-exclusive license to use what I produce.

<snip>

David

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


2002\03\26@164208 by Rick C.

flavicon
face
I agree, but this was back in the early '70s. We engineers were young and
innocent. The company did a lot of things that weren't legal but it was either
signing, or "out the door". Learned a lot since then.
Rick

michael brown wrote:

{Quote hidden}

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


2002\03\26@171017 by Jinx

face picon face
> I must be missing something.  I wish to retain copyright,
> but give them non-exclusive license to use what I produce

Ah, I think I might be with you now, but it's not clear from
your posts as to who's idea it is. The product will be yours,
in general copyright terms, but where did the idea come
from ? How can you be a contractor on your own work ?

"I will be developing some PIC code for a small project
under contract on an hourly basis.  The company has expressed
concern with my retaining copyright.  I think the real concern is
about me producing a competetive product on my own, although
I have no interest in that.  I am looking for example contracts
that I can draw from"

Playing Devil's advocate (ie not taking sides), if you retain
the copyright and, rather than "but", give them non-exclusive
license, what's in it for them ? If you've no interest in a product
of your own, then why not give them exclusive license ? I can
understand why they'd be feeling exposed. Only by giving them
exclusive license would you be able to assure them that they
are not going to be gazumped by competition some day. You
can still hang on to the copyright of course

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


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