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

Exact match. Not showing close matches.
PICList Thread
'[PIC]: i'm F628 embarassed!'
2002\08\29@131633 by Roman Black

flavicon
face
I'm F628 embarrased! After all the recent threads
on converting F84 code to F628 I'm stuck and can't
make it work!

I did the config fuses, covered all the ram issues
(only using a few bytes anyway), turned the
comparators off before I do much else, and have
been right through both datasheets and tried a
number of chips.

The result i'm getting is that F84 works fine, but
the same code in the F628 doesn't work.

The F628 outputs are being set to the normal values
at the start of the program, but the input pulses
into a porta pin don't seem to cause any action,
so i'm guessing either the porta input is not being
detected or for some reason the PIC is latched up or
software hung up. The pin voltages are correct, the
pulses are going into the porta pin and it is obviously
an input.

All ints are off in INTCON, and i'm writing 0x07
b'00000111' to the CMCON. I don't often ask for help
with PIC coding but after 2 hours of fiddling and
checking it has me beat for tonight anyway, so I
wondered if someone had seen something like this
before??
-Roman

PS. I am doing a couple of jump tables in page 0.
I just leave PCLATH cleared which is done in the
setup code.

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


2002\08\29@151129 by =?iso-8859-1?Q?F=E1bio_Pereira?=

flavicon
face
Hi Roman !

Maybe you could your code listing ...

I have many succesfull migrations to/from 16F62x, none of them with serious
problems.

Best Regards,

Fabio Pereira

{Original Message removed}

2002\08\29@153520 by Dwayne Reid

flavicon
face
At 03:13 AM 8/30/02 +1000, Roman Black wrote:

>All ints are off in INTCON, and i'm writing 0x07
>b'00000111' to the CMCON.

CMCON is on ram page 1 - check to make sure that you switch to page 1 (and
back again).

dwayne


--
Dwayne Reid   <.....dwaynerKILLspamspam@spam@planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

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


2002\08\29@185311 by Tony Nixon

flavicon
picon face
Dwayne Reid wrote:
>
> CMCON is on ram page 1 - check to make sure that you switch to page 1 (and
> back again).

RAM Page 0 :-)

--
Best regards

Tony

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

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


2002\08\29@230519 by Roman Black

flavicon
face
David Duffy wrote:

> I've done a dozen or so F628 projects so far. CMCON bit me too!
> Regards...


Thank you David and everyone else who helped.
I found the "bug" but not real happy about what it
was... I have put the code below.

----------------------------------------------
This code DOES NOT work, sympoms are same as CMCON not
set properly:

       IFDEF  __16F628

               banksel 0               ;
               movlw b'00000111'       ; disable comparators
               movwf CMCON             ;

               clrf T1CON              ; disable timer1
               clrf T2CON              ; disable timer2
               clrf CCP1CON            ; disable CCP module

               banksel 1               ; do bank 1 stuff
               clrf VRCON              ; disable Vref
               clrf PIE1               ; disable pi etc
               banksel 0               ;
       ENDIF

----------------------------------------------
This code works!!!

       IFDEF  __16F628

               banksel 0               ;
               clrf T1CON              ; disable timer1
               clrf T2CON              ; disable timer2
               clrf CCP1CON            ; disable CCP module

               banksel 1               ; do bank 1 stuff
               clrf VRCON              ; disable Vref
               clrf PIE1               ; disable pi etc
               banksel 0               ;

               movlw b'00000111'       ; disable comparators
               movwf CMCON             ;
       ENDIF
----------------------------------------------

I fiddled with it a bit, and it only seems to do the
"movwf CMCON" if it occurs AFTER the VRCON/PIE pair!!!!

Is there a known F628 bug where CMCON has to be done
AFTER clearing VRCON or PIE1 registers?? Or is this
some freaky MPASM fault with the IFDEF directives??

Or am I so completely stupid that I have no idea what
i've done wrong?? :o)
-Roman

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


2002\08\29@233645 by Bob Bullock

flavicon
face
The behavior would imply a problem with the bank select command.  If it
were not correctly switching to bank 1, then the clrf VRCON would be
clearing the value moved into CMCON in the first example.  Have you
followed this code through on the simulator?  It's usually a pretty good
way to check this sort of problem.

regards,

Bob Bullock


At 12:59 PM 8/30/2002 +1000, you wrote:
{Quote hidden}

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


2002\08\29@235847 by Bob Bullock

flavicon
face
Looking at the banksel command syntax, it is banksel <label>
I would think it is taking the 1 as a variable address and generating a
switch to bank 0 command
so you can access location 0x001

regards,

Bob Bullock

At 12:59 PM 8/30/2002 +1000, you wrote:
{Quote hidden}

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


2002\08\30@035826 by Roman Black

flavicon
face
Thanks very much Bob, you got it right in one. :o)

It's a source of constant amazement the multitude of
ways I stuff things up! Would you believe I quickly
added the VRCON/PIE1 chunk just before my first test,
in anticipation that I might have F628 compatibility
problems! No that's not my normal way of bank switching.

This list is great, I should buy another PicList mug. :o)
-Roman



Bob Bullock wrote:
{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


2002\08\30@074331 by Olin Lathrop

face picon face
> Thank you David and everyone else who helped.
> I found the "bug" but not real happy about what it
> was... I have put the code below.

Maybe you're ready for a better way of doing this.  Check out my PORT module
at http://www.embedinc.com/pic.  It would have automatically taken care of
this issues and made porting much easier.  It does an IFDEF on CMCON to
decide whether to disable the comparators.  There is similar code for the
A/D which will save from trouble next time you move to a different
processor.

{Quote hidden}

This doesn't make any sense.  This smells like the problem is elsewhere and
just appears to be related to CMCON.  Are interrupts truly off at this
point?  If not, changing what happens before and after messing with PIE1
could change the behavior.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, 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


2002\08\30@074951 by Olin Lathrop

face picon face
> The behavior would imply a problem with the bank select command.  If it
> were not correctly switching to bank 1, then the clrf VRCON would be
> clearing the value moved into CMCON in the first example.  Have you
> followed this code through on the simulator?  It's usually a pretty good
> way to check this sort of problem.

Hmm, that's a possibility.  Microchip did have a bug in an early version of
the PAGESEL directive, so why not BANKSEL?  You might also want to check out
my DBANKIF and related macros in STD.INS.ASPIC at
http://www.embedinc.com/pic.  This is used to set the bank, but is more
efficient.  Assembler state is used to track the current bank and only those
bank switching instructions that are necessary (perhaps none) are emitted.
Another nice feature is that you pass the address of whatever it is you want
to access.  That eliminates mistakes in hard coding the bank and increases
portability.  For example:

    dbankif cmcon    ;set banks for access to CMCON, wherever it is
    movlw   b'00000111' ;get value to disalbe the comparators
    movwf   cmcon    ;stuff it


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, 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


2002\08\30@120022 by Roman Black

flavicon
face
Olin Lathrop wrote:

> Maybe you're ready for a better way of doing this.  Check out my PORT module
> at http://www.embedinc.com/pic.  It would have automatically taken care of
> this issues and made porting much easier.  It does an IFDEF on CMCON to
> decide whether to disable the comparators.  There is similar code for the
> A/D which will save from trouble next time you move to a different
> processor.


Thanks Olin. There are number of things in this
project that are not the way I like to do things. :o)
It will be open sourced and some parts are coded
in a way that's not really good programming but
coded so a beginner can modify it and adapt it to
their needs.
I do like the sound of your PORT module and will
check it out. :o)
-Roman

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


2002\08\30@154348 by Dwayne Reid

flavicon
face
At 08:46 AM 8/30/02 +1000, Tony Nixon wrote:
>Dwayne Reid wrote:
> >
> > CMCON is on ram page 1 - check to make sure that you switch to page 1 (and
> > back again).
>
>RAM Page 0 :-)

Now I'm embarrassed - you are right.  Its VRCON that's on page 1.

I just finished doing a project with those - the project worked so I had it
right at that time.

<sigh>

dwayne

--
Dwayne Reid   <dwaynerEraseMEspam.....planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

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


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