12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Manual section
    4.18. Comparison Operators
    Not equal !=

    I guess a question here would be how fast does a PIC receive DATA?
    I think once the PIC starts receiving with SERIN2 it will not stop till finished. I will have to check to be.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Manual section
    4.18. Comparison Operators
    Not equal !=
    Cheers mackrackit, thanks for the pointer.

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Calculate checksum by adding 2 data bytes together
    Code:
    CheckSum = DAT_IN1 + DAT_IN2
    So the CheckSum = (%10101011 * 2 BYTES) if SW1 ( GPIO.3) was pressed.

    or (%10101101 * 2 BYTES) if SW2 (GPIO.4) was pressed.

    Plus we should have the already have a calculated CHK_SUM that was sent.

    So:

    Code:
    CHK_SUM   VAR BYTE  ' Holds checksum received
    And:

    Code:
    CheckSum  VAR BYTE  ' Computed checksum of all bytes received
    Therefore:

    Code:
    IF CheckSum != CHK_SUM THEN MAIN ' Failed checksum, return
    If Checksum (!) is not = CHK_SUM then go back to MAIN the checksum has failed.

    The same with:

    IF (DAT_IN1) != (DAT_IN2) THEN MAIN ' Failed data comparison, return
    The DAT_IN BYTES must also be equal, if not then back to MAIN:

    If however everything matches then continue to MATCH..........

    How does this look?

    Dave
    Last edited by LEDave; - 22nd November 2010 at 18:59.

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


    Did you find this post helpful? Yes | No

    Default

    Another question:

    Code:
    wsave   VAR	BYTE $5F system	   ' Saves W
    Bruce's code talks of Bank0 system. Am I correct in saying that BYTE $5F system is setting bit.5 of the STATUS REG to 0 which is selecting Bank0 ($5f = %1011111).

    So to change from Bank0 to Bank1 would be %1111111

    Also:

    Code:
    movwf  wsave	 ; Save W
    So these commands mean Move the contents of the W REG to the address of wsave.

    Mm, not really sure about this............(more reading to do).

    Dave


    Dave
    Last edited by LEDave; - 22nd November 2010 at 23:43.

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


    Did you find this post helpful? Yes | No

    Default

    The DAT_IN BYTES must also be equal, if not then back to MAIN:

    If however everything matches then continue to MATCH..........

    How does this look?
    I think you got that part down.

    Bruce's code talks of Bank0 system. Am I correct in saying that BYTE $5F system is setting bit.5 of the STATUS REG to 0 which is selecting Bank0 ($5f = %1011111).

    So to change from Bank0 to Bank1 would be %1111111
    Like I said, ASM is not my strong point. Not sure I have a strong point...
    Below tells how to change banks, I think.
    Code:
    If the PICmicro has more than 2K of code space, an interrupt stub is automatically added that saves the W, STATUS and PCLATH registers into the variables wsave, ssave and psave, before going to your interrupt handler. Storage for these variables must be allocated in the BASIC program:
    
    	wsave  var	        byte $20 system
    	wsave1 var	byte $a0 system		' If device has RAM in bank1
    	wsave2 var	byte $120 system	' If device has RAM in bank2
    	wsave3 var	byte $1a0 system	' If device has RAM in bank3
    	ssave    var	byte bank0 system
    	psave    var	byte bank0 system
    Code:
    movwf  wsave	 ; Save W
    So these commands mean Move the contents of the W REG to the address of wsave.
    Yes.
    Also notice that all of the data is restored in the opposite sequence it was saved.

    If I am giving wrong ASM info , somebody please jump in and correct me!
    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

    Hi mackrackit,

    Not sure I have a strong point...
    Hey, you put up with me, so patience is one of them

    And don't forget it was trying to turn an LED on using ASM that after a near breakdown put me onto PBP

    I'll go onto MATCH & DECODE tomorrow, slowly getting there (slowly).

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    It still doesn't take much to stump me I'm afraid........

    Code:
     MATCH = MATCH + 1        ' We have a match so increment match count
        IF MATCH = 2 THEN DECODE ' Everything matched twice, we're good
        GOTO Main                ' Else do it all over
    When the Timer was set up for a 65ms reset we had:

    Code:
    MATCH = 0           ' Clear match count
    Then the SYNCH_BYTE & DATA etc arrived and everything was good giving:

    Code:
    MATCH = MATCH + 1        ' We have a match so increment match count
    So to my mind that makes MATCH = 0 +1 ie 1.

    But then we have:

    Code:
     IF MATCH = 2 THEN DECODE ' Everything matched twice, we're good
    So either the data arrives twice within the 65ms time period to move onto DECODE or my understanding of MATCH = MATCH + 1 is wrong.

    Help!

    Dave

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