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

    I'm still working hard on this........!

    I know what I need to do to get this to work (on paper as it were, I think I do anyway). I'm reading and GQQGLing like made to find and learn the programming skill I need to make it work.

    If I can't crack it tonight I'll have to ask, tick, tick, tick....must dash.

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Well I did try.......

    It was getting the LCD to output B0 as a DEC number (LCD location for the smiley) rather than just B0 that foxed me. I tried DEC B0 and a few other things ("."B0..."B0") but still no good. I think (and hope) I was on the right lines though.

    Here's my attempt:

    Code:
    BO VAR BYTE          'BYTE 0  Sets position for CHAR  128...+19
    LC var byte          'Loop_Count Counts 0 to 19 'positions' across display
    
    LCDOut $FE,$60,$00,$0a,$0a,$00,$00,$11,$0e,$00  'Smiley Face
    
    Pause 500
    MAIN
    For LC = 0 TO 19
    PAUSE 500
    LET BO = 128 + LC     'Start at LCD Top LHS then add 1 to move across display
    LCDOUT $FE,1,B0,0     'Output the 'Smiley Face' at location B0
    PAUSE 500
    Next LC
    GOTO MAIN
    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Reallllllly close
    Made a couple smal changes
    Code:
    LCDOut $FE,$40,$00,$0a,$0a,$00,$00,$11,$0e,$00  'Smiley Face
    For LC = 0 TO 19
    PAUSE 500
    LET BO = 128 + LC     'Start at LCD Top LHS then add 1 to move across display
    LCDOUT $FE,1
    LCDOUT $FE,BO,0     'Output the 'Smiley Face' at location B0
    PAUSE 500
    Next LC
    GOTO MAIN
    But there is still one small problem...
    I will leave that for you
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Well I compiled it and it ran........ Like you say I wasn't a million miles off on this one which is pleasing.

    But there is still one small problem...
    Mmm, I've looked and looked and I can't see one. Was it from the original brief where you said use a CONSTANT and I've used a VARIABLE?

    Quick question. In the program you made the change of address from $60 to $40, that's because the Custom characters are given memory addresses $40.....$78 (Char 0 - 7) and they must be sequential right? In other words I had Character '0' at address $60 which was a mistake.

    Also having the:

    LCDOUT $FE,1
    Simply clears the display on every loop so the next increment of LC moves the character along one and clears the previous character.

    Dave (Oop's what's next?)

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    Mmm, I've looked and looked and I can't see one. Was it from the original brief where you said use a CONSTANT and I've used a VARIABLE?
    OOPPSS! Now I am the one that can not count. I have a 16x4 I use for testing. It would work for you 20x4 display.
    Quick question. In the program you made the change of address from $60 to $40, that's because the Custom characters are given memory addresses $40.....$78 (Char 0 - 7) and they must be sequential right? In other words I had Character '0' at address $60 which was a mistake.
    Yes, your were calling the wrong address.
    Simply clears the display on every loop so the next increment of LC moves the character along one and clears the previous character.
    Code:
    LCDOUT $FE,1
    Can not have a character location after it, only display commands. But for spped you can do this, (a snippet from,,)
    Code:
     LCDOUT $FE,1,"THE TEMPERATURE",$FE,$C0,"IS: ",DEC TRESULT,$FE,$90,"BAD READS ",DEC BCS
    Dave (Oop's what's next?)
    I will get back to you with something
    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

    Thanks for that mackrackit, a great help.

    I will get back to you with something
    As and when mackrackit, we're all busy.

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Had to look over what we have done so far.
    Serial
    LCD
    Some program flow.
    Input from a switch

    How about remembering something?
    Let's say you have some parts moving along a conveyor and you want to count how many parts have passed by a certain point. But the problem is when the machine is turned off and then turned back on the counting starts back at zero and you want total parts counted for a week.

    You can use the push button to simulate when a part passes by and have a WORD size variable increment each time the switch is activated and that value displayed someplace (serial or LCD).

    To save the value for when the machine is turned off and on you will need to save the value to EEPROM and read from the EEPROM when the machine is started again. Place that value into the counting variable to continue counting from where it left off.

    Another problem that can be addressed later is the EEPROM only has 1,000,000 write cycles so if the EEPROM is written to each time a part passes depending on how fast things are moving you could wear out the EEPROM in a matter of weeks.
    So a shut down sequence is needed to only write to the EEPROM at shut down. This is not hard for scheduled shut downs but can be a "trick" for power failures.

    For now you can have the value written to The EEPROM each time the variable is incremented.

    Are you still using a 16F684 ?
    Dave
    Always wear safety glasses while programming.

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