RMW Read modify write


Results 1 to 13 of 13

Threaded View

  1. #1
    Join Date
    Feb 2010
    Posts
    30

    Default RMW Read modify write

    This is simple Led-blink code that does not work.

    LED5 flashes normally, and LED 4 stable HIGH.................

    Using a 12F1822 (RA4 is not open collector in this PIC).


    Code:
    ASM
     __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
     __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_ON & _STVREN_OFF & _BORV_HI & _LVP_OFF
    ENDASM
     
        DEFINE OSC 32
        LED5 VAR PORTA.5
        LED4 VAR PORTA.4
        
        OSCCON = %01110000               
        ANSELA = %00000011  ' AN0 = ANALOG PIN , C1IN0- = ANALOG PIN
        TRISA =  %00000000 
        
    LOOPA:
                                       
         LED4 = 1
         LED5 = 1
         PAUSE 100
         
         LED4 = 0
         LED5 = 0
         PAUSE 100
         
         GOTO LOOPA
    when LOOPA modified as above works fine and both LEDs blinking.

    Code:
    LOOPA:
                                       
         LED4 = 1
         LED5 = 1
         PAUSE 100
         
         LED4 = 0
         PAUSEUS 2  <---
         LED5 = 0
         PAUSE 100
         
         GOTO LOOPA
    EDIT : instead of the 2us pause , i tried another command like modifying a variable , XX = 1 and still works.
    So the conclusion is , two LEDx = 0 commands in the row cannot be processed normally (although LEDx = 1 works) .
    The UFO's coming ...
    Cheers!
    Last edited by LakisFM1; - 30th May 2014 at 17:08.

Similar Threads

  1. PLEASE HELP...read write issues
    By nomad77 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 17th March 2011, 14:39
  2. Write/Read DS1996
    By Bosse in forum Forum Requests
    Replies: 2
    Last Post: - 9th September 2008, 00:25
  3. DS1996 Read/Write
    By Bosse in forum Serial
    Replies: 0
    Last Post: - 30th October 2007, 13:36
  4. Read and write to sd card
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th October 2007, 19:47
  5. Read Modify Write problem?
    By markedwards in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th November 2005, 21:02

Members who have read this thread : 1

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