Problem with 16Ff648a


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1

    Default Problem with 16Ff648a

    My program works 100% with 16F628A, using MCode V3.0.0.5, and PB, I re-compile for 16F648A and program but it does not even start.

    If I compile for 16F628a and blow that into the 648A chip it works. Unless I have missed something, the only difference between the 628A and 648A is the memory ram and eeprom.


    I have pinned the problem down to the CLEAR command ********.
    No problem in the 628A, but fails in 648A

    If I remove the CLEAR in the 648A it works, with it in, it doesn't.

    I think maybe the CLEAR has a problem with the 648A somewhere.

    Any suggestions/ideas greatfully received. Thanks




    DEFINE OSC 20
    @ device PIC16F648A,HS_OSC,BOD_ON,MCLR_ON

    TRISA = 0
    TRISB = 0



    CS1 var PORTB.7 'Connect this to CS11 (set dip switchs to 1 = on 2/3/4 = off)
    CS2 VAR PORTA.0
    WR var PORTA.4 'connect this to wr ACTUALLY CLOCK BUT HOLTEK CALL IT MR
    DATALINE var PORTA.1 'connect this to DATA

    DEFINE HSER_TXSTA 20H
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_BAUD 4800
    DEFINE HSER_CLROERR 1 ' Clear error automatically when ncountered




    MATRIXB VAR BYTE (72)
    MATRIXA VAR BYTE (63)
    CLOCK VAR BYTE(8)
    PREVIOUSTIME VAR BYTE(8)
    DATE var byte(6)
    LOOP VAR BYTE ' FOR COUNTING
    DIGITS VAR BYTE ' FOR COUNTING
    COUNTER var byte ' FOR COUNTING
    COUNTER2 var byte ' FOR COUNTING
    ADDRESS var byte ' DISPLAY
    COMD var byte ' DISPLAY
    ENDBIT var bit ' DISPLAY
    SENDDOTS var byte ' DOT COLUMN
    NUMBER VAR BYTE ' USED TO SORT ALPHA AND NUMERIC
    CLEAN VAR BYTE
    TEMP VAR BYTE
    TEMP2 VAR BYTE
    START VAR BYTE
    ENDLIST VAR BYTE ' USED IN LOOKUP TABLES
    DISPLAY VAR BYTE 'USED FOR CHIP SELECTION

    LONGTEMP VAR WORD
    HOURSTENS VAR CLOCK(0)
    HOURSUNITS VAR CLOCK(1)
    COLON1 VAR CLOCK(2)
    MINSTENS VAR CLOCK(3)
    MINSUNITS VAR CLOCK(4)
    COLON2 VAR CLOCK (5)
    SECSTENS VAR CLOCK(6)
    SECSUNITS VAR CLOCK(7)

    DAYSTENS VAR DATE(0)
    DAYSUNITS VAR DATE(1)
    MONTHTENS VAR DATE(2)
    MONTHUNITS VAR DATE(3)
    YEARTENS VAR DATE(4)
    YEARUNITS VAR DATE(5)


    SCROLLSINGLE VAR BIT (8)

    ' FOLLOWING VARIABLES ARE FOR WHEN DAYLIGHT SAVING IS SWITCHED ON
    GPSDAY VAR BYTE
    GPSMON VAR BYTE
    GPSYEAR VAR BYTE
    STARTWKDAY VAR BYTE
    A VAR BYTE
    Y VAR BYTE
    M VAR BYTE
    D VAR BYTE
    SUMMERTIMESWITCH VAR BYTE
    MARDAY VAR BYTE
    OCTDAY VAR BYTE
    SUN VAR BYTE
    CURRENTYEAR VAR BYTE


    'SUMMER/WINTER SWITCH VALUES
    DATA @64,0,0,0,0,1,1,1,1,1,1,1,0,0 '0 = GMT 1 = BST
    ' X J F M A M J U A S O N D 0 = WINTER 1 = SUMMER
    ' 0,0,0,0,1,1,1,1,1,1,1,0,0 X=0 MONTH NOT USED !

    DATA @80,0 'HOURS OFFSET




    CLEAR ' ALL VARIABLES TO 0 ******************

    CMCON=7 ' SET PORT A DIGITAL
    pause 1000
    TEST:
    low PORTB.7
    PAUSE 250
    HIGH PORTB.7
    PAUSE 250
    GOTO TEST

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    99 % of the time, if it works in one device, but not another the problem is in the configuration registers. The defaults don't always work for any given application.
    Charles Linquist

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Question

    HI

    Just cut and paste ...

    replace LOOP for LOOP1 for PBP 2.60

    ...

    Success 84 Words used
    So, this is not a chip problem ( I often use both chips ... no difference @ use )

    BINGO ...
    You should verify your Arrays declarations ... " illegal syntax " ...

    Alain
    Last edited by Acetronics2; - 10th November 2009 at 16:30. Reason: Bingo ...
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I knew about the LOOP variable and had changed its name for 2.60, and the result is the same, yes 84 words used, but it crashes, compiled with 2.43 or 2.6.

    The configuration bits are the same for 628A and 648A, the only difference in these 2 chips is the extra memory size.

    CLEAR is definately the problem, as if it is removed the program works, put it back and it does not. As far as I know CLEAR only writes zeros into all the declared memory locations and does nothing else


    Perhaps someone at Melabs could give me the reason why removing CLEAR makes the program work.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Stupid question...
    But are you changing this line as needed?
    @ device PIC16F648A,HS_OSC,BOD_ON,MCLR_ON

    And selecting the correct PIC at compile time?
    Dave
    Always wear safety glasses while programming.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Stupid question...
    But are you changing this line as needed?
    @ device PIC16F648A,HS_OSC,BOD_ON,MCLR_ON

    And selecting the correct PIC at compile time?
    Yes.
    PIC data sheet DS40044F, Page 1 says

    pic 628a program words 2048, sram 224 bytes, eeprom 128 bytes,

    pic 648a program words 4096, sram 256 bytes, eeprom 256 bytes,


    As I said the ONLY difference between the 628A and 648A is the extra memory size, program, and EEprom, you can, as I have proved, put the hex file of the 628A into the 648A and it works. The compiled size for 628A is 77 bytes with PB2.43. Compile for the 648A and size is 84 words. ( extra words presumably to account for the bit extra memory)

    I have now reduced the program to its simplest form for 648A, and before anyone else raises the configuration bits on programming, they are standard, HS,watchdog, power up timer, brownout, master clear reset are all selected, code protection off,and the correct pic.

    *************PROGRAM 1 compiles to 51 words pb2.43 and pb2.6
    DEFINE OSC 20
    CHECKVARIABLE VAR BYTE

    TEST:
    LOW PORTB.7
    PAUSE 250
    HIGH PORTB.7
    PAUSE 250
    GOTO TEST

    the above WORKS !

    *********PROGRAM 2 with the CLEAR ADDED compiles to 73 words pb2.43 and pb2.6

    DEFINE OSC 20
    CHECKVARIABLE VAR BYTE
    CLEAR
    TEST:
    LOW PORTB.7
    PAUSE 250
    HIGH PORTB.7
    PAUSE 250
    GOTO TEST

    The above does NOT WORK.

    you can even remove my CHECKVARIABLE and the results are the same.
    eg
    DEFINE OSC 20
    CLEAR
    TEST:
    LOW PORTB.7
    PAUSE 250
    HIGH PORTB.7
    PAUSE 250
    GOTO TEST
    does not work

    So it still looks as though the CLEAR is causing the problem, CLEAR only writes zeros to all the ram memory space, so it does not matter whether you have variables declared or not.
    Last edited by aerostar; - 11th November 2009 at 08:55.

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Talking The ghost bug ....

    Hi,

    At the moment ...

    I have my personnal 18 pins test board in front of me, Pic is a 16F648a, loaded with your program ( no mod ... )

    you know what ??? ...

    Led @ PortB.7 BLINKS !!!

    Picture required ???

    soooo ... try another '648 ... after checking your board and solders ...

    Alain
    Last edited by Acetronics2; - 11th November 2009 at 10:13.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Problem to compile my program
    By wagner in forum Off Topic
    Replies: 5
    Last Post: - 7th July 2008, 20:17
  2. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  3. Microcode Studio 18f2455 problem?????
    By volkan in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 21st May 2007, 21:04
  4. Hardware problem or what ?
    By Steve S. in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 4th March 2007, 21:39
  5. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts