12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    Slow but steady progress tonight. I wouldn't go so far as to say the end is in sight but things are moving along.

    Now here's a question. Since I joined this FORUM in February I think it was. I've gone from not being able to blink an LED to having a working LCD in under 12 weeks, not to mention the Serial Communicator and other stuff we've done.

    So here's the question: Have you ever considered writing a book for 'Newbies' like me? I'll be perfrectly honest here, determined as I am, if I hadn't found this FORUM, well I would really has struggled to move on let's put it that way.

    Just a thought.

    Dave
    Last edited by LEDave; - 9th May 2010 at 00:44.

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


    Did you find this post helpful? Yes | No

    Default

    BOOK
    Nope, I have though about getting an "education" so I could teach at the local college though. That would be fun.

    The problem I have with books are the authors. The is a popular author out there on this subject that is even a member of this forum. Many newbies come to this forum after reading his book(s) and they still do not know much more than you did when you came here. Does the book author help out on the forum? Nope. So it seems there are books out there with out support. What good is that other than the author making money.

    So I figure if someone wants to learn, skip the book and go straight to the people that really want to help others learn. For PBP that would be this forum.

    Keep hanging out here on the forum, read every post and take lots of notes, when you see someone with a problem and you have an answer post it.

    Then someday someone will say to you, have you ever considered writing a ......
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default



    I hear what you're saying mackrackit.

    Keep hanging out here on the forum, read every post and take lots of notes, when you see someone with a problem and you have an answer post it.
    That would be nice, to be able to give something back to the FORUM...One day!

    Dave

  4. #4
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    UPDATE:

    I'm getting steadily closer.....!

    One piece of the program isn't doing what I want it to.....Grrr.

    I may have to ask for a pointer.

    Dave
    Last edited by LEDave; - 9th May 2010 at 21:47.

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


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Well I gave a good go and in the end my lack of knowledge failed me.

    Here's what the program does:

    1/ It displays the 'Total' on line one.
    2/ It displays the number of Machine Starts on line two.

    Here's where things go wrong though. On line three it displays the Parts run count 1-5 but the number of parts run between stops always equals 'Total' and not 'Total - parts run' ie the difference.

    I've spent hours trying to crack it but I'm missing something.

    I'll post the whole program below, I'm sure there's lots of unnecessary and duplicated code (not to mention mistakes) within the program but hey I'm still a 'Newbie'.

    Dave
    Last edited by LEDave; - 10th May 2010 at 18:13.

  7. #7
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00100000    'Set PORTA.5 as INPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    DEFINE LCD_DREG     PORTC    'PORTC.0 WILL CONNECT TO DB4, PORTC3 TO DB7
    DEFINE LCD_DBIT     0
    DEFINE LCD_RSREG    PORTC
    DEFINE LCD_RSBIT    4        'PORTC.4 CONNECT TO LCD PIN4
    DEFINE LCD_EREG     PORTC
    DEFINE LCD_EBIT     5        'PORTC.5 CONNECT TO LCD PIN6
    DEFINE LCD_BITS     4
    DEFINE LCD_LINES    4
    DEFINE LCD_COMMANDUS 2000     
    DEFINE LCD_DATAUS 150
    
    DEFINE OSC 4
    
    TOTAL  VAR WORD  'STORED IN EEPROM LOCATIONS 0 AND 1
    PS_1   VAR WORD  'STORED IN EEPRON LOCATIONS 2 AND 3
    PS_2   VAR WORD  'STORED IN EEPRON LOCATIONS 4 AND 5
    PS_3   VAR WORD  'STORED IN EEPRON LOCATIONS 6 AND 7
    PS_4   VAR WORD  'STORED IN EEPRON LOCATIONS 8 AND 9
    PS_5   VAR WORD  'STORED IN EEPRON LOCATIONS 10 AND 11
    M_S    VAR BYTE  'STORED IN EEPRON LOCATIONS 12 
    
    clear                 'Re_set volatile memory to zero (Not EEPROM?)
    
    MAIN:
    
    gosub MC_S            'Set & increment M/C Starts Total subroutine
    gosub Power_up        'On Power_up GOTO READ EEPROM subroutine
    gosub Parts_Run       'Number of parts made
    
    
    Start:
    if PORTA.5 = 0  then  count_up: 'If button pressed start counting
    IF PORTA.5 = 1  THEN     Start: 'If button not pressed loop until it is
        
    Count_up:                 'Button has been pressed
    let Total = Total + 1     'Add one to value of Total taken from EEPROM
    pause 100
    LCDOUT $FE,2,"Total=",DEC TOTAL  'Display Total on LCD
    Write 0, Total.HIGHBYTE   ' Write high byte of Total word to EEPROM
    Write 1, Total.LOWBYTE    ' Write low byte of Total word to next address
    GOTO sTART:
    
    MC_S:                     'MC Starts subroutine
    READ 12, M_s              'Read current number of M/C Starts
    LET M_S = M_S + 1         'Increment value by one
    WRITE 12, M_S             'Save new value
    READ 12, M_s              'Read latest value
    pause 150                 'Give LCD a chance to Power_up
    LET M_S = M_S             'Set value to display
    LCDOUT $FE,$C0, "Machine Starts=",DEC M_S 'Display M/C Starts on LCD from EEPROM
    RETURN
    
     
    Power_up:                 'Power_up subroutine
    Read 0, Total.HIGHBYTE	  ' Read high byte
    Read 1, Total.LOWBYTe     ' Read low byte  
    LET Total = Total         'Set Total to value set in EEPROM Memory
    pause 150                 'Give LCD a chance to Power_up
    LCDOUT $FE,2,"Total=",DEC Total 'At Power_up display Total on LCD from EEPROM
                              'Memory which has been stored since Power_down
    return 
    
    Parts_Run:
    SELECT CASE M_S 
       CASE 1
       if M_s = 1 then PARTS1: 
       CASE 2
       IF M_S = 2 THEN PARTS2:
       CASE 3
       IF M_S = 3 THEN PARTS3:
       CASE 4
       IF M_S = 4 THEN PARTS4:
       CASE 5
       IF M_S = 5 THEN PARTS5:
    END SELECT 
    RETURN
    
    PARTS1:
    let PS_1 = Total
    WRITE 2,PS_1.HIGHBYTE
    WRITE 3,PS_1.LOWBYTE
    READ  2,PS_1.HIGHBYTE
    READ  3,PS_1.LOWBYTE
    LET PS_1 = PS_1
    PAUSE 150
    LCDOUT $FE, $94,"Parts1=",DEC PS_1
    return
    
    
    PARTS2:
    LET PS_2 = Total - PS_1
    WRITE 4,PS_2.HIGHBYTE
    WRITE 5,PS_2.LOWBYTE
    READ  4,PS_2.HIGHBYTE
    READ  5,PS_2.LOWBYTE
    LET PS_2 = PS_2
    PAUSE 150
    LCDOUT $FE, $94,"Parts2=",DEC PS_2
    return
    
    
    PARTS3:
    LET PS_3 = TOTAL - PS_2
    WRITE 6,PS_3.HIGHBYTE
    WRITE 7,PS_3.LOWBYTE
    READ  6,PS_3.HIGHBYTE
    READ  7,PS_3.LOWBYTE
    LET PS_3 = PS_3
    PAUSE 150
    LCDOUT $FE, $94,"Parts3=",DEC PS_3
    return
    
    
    PARTS4:
    LET PS_4 = TOTAL - PS_3
    WRITE 8,PS_4.HIGHBYTE
    WRITE 9,PS_4.LOWBYTE
    READ  8,PS_4.HIGHBYTE
    READ  9,PS_4.LOWBYTE
    LET PS_4 = PS_4
    PAUSE 150
    LCDOUT $FE, $94,"Parts4=",DEC PS_4
    return
    
    
    PARTS5:
    LET PS_5 = TOTAL - PS_4
    WRITE 10,PS_5.HIGHBYTE
    WRITE 11,PS_5.LOWBYTE
    READ  10,PS_5.HIGHBYTE
    READ  11,PS_5.LOWBYTE
    LET PS_5 = PS_5
    PAUSE 150
    LCDOUT $FE, $94,"Parts5=",DEC PS_5
    return
    Last edited by LEDave; - 10th May 2010 at 18:09.

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