MRF90XAM9A interfacing help


Closed Thread
Results 1 to 40 of 64

Hybrid View

  1. #1
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151

    Default MRF90XAM9A interfacing help

    Good Afternoon All-
    I have been trying to get the MRF89XAM9A module to work with a PIC18F66J11 and I can't seem to get the read function to work (SPI) so I can see if I am setting up the module correctly.
    I am hopefully writing to the module then reading back from it to verify the register - but it doesn't work......

    I have looked on this forum for sometime but no one seems to have either tried or shared how to set up the regs and how to just very simply to communicate to/from it.
    Its just a simple many transmitter to one receiver idea, only a payload of 3 bytes!

    If anyone HAS gotten this to work, I would appreciate any guidance ......

    Code below for all to see.....
    -Steve

    Code:
    #CONFIG
        CONFIG  WDTEN = OFF           ; WDT NOT enabled
        CONFIG  STVREN = ON           ; Reset on stack overflow/underflow enabled
        CONFIG  XINST = OFF           ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
        CONFIG  DEBUG = OFF           ; Background debugger disabled; RB6 and RB7 configured as general purpose I/O pins
        CONFIG  CP0 = OFF             ; Program memory is not code-protected
    ;    CONFIG  FOSC = INTOSC	  ; Internal oscillator, port function on RA6 and RA7 
        CONFIG  FOSC = INTOSCPLL	  ; INTOSC with PLL enabled, port function on RA6 and RA7
        CONFIG  FCMEN = OFF           ; Fail-Safe Clock Monitor disabled
        CONFIG  IESO = OFF            ; Two-Speed Start-up disabled
        CONFIG  WDTPS = 512           ; 1:512
        CONFIG  CCP2MX = DEFAULT      ; ECCP2/P2A is multiplexed with RC1
        CONFIG  MSSPMSK = MSK7        ; 7-Bit Address Masking mode enable
    #ENDCONFIG
    Asm
        ERRORLEVEL -306
    Endasm
    '---------------------------------------------------------------------------------------
    'Define the oscillator, INCLUDE files, A2D setup
        DEFINE  OSC 8					'8 MHz oscillator, internal x 4 via PLL = 32MHz  
        INCLUDE "DT_INTS-18.bas"                                                    'Base Interrupt System - miss DT!
        INCLUDE "ReEnterPBP-18.bas"                                                 'Include if using PBP interrupts
    '    DEFINE RX2_INT PIR4,RC2IF,PIE4,RC2IE                'Used to ADD the 2nd serial port to the interrupt scheme
        DEFINE  ADC_BITS 10     ' 10-bit resolution
        DEFINE  ADC_CLOCK 5     ' Set clock source to Frc/16
        DEFINE  ADC_SAMPLEUS 50 ' Sample time in uS before A/D conversion is started
        Quanta  CON 1251        ' For 10-bit A/D +Vref = 5V : 5V/1023*256=1.251=Quanta
        ADCON1.7 = 1            ' Right justify for 10-bit
        ADCON0 = %00001001      ' VRef is 3.3v and Gnd, select AN2, A2D is ENABLED
        ANCON0_ALT = %11011010  ' AN2 and AN0 set as ANALOG input, rest are DIGITAL
        ANCON1_ALT = %11111111  ' Rest of inputs set as DIGITAL
    '---------------------------------------------------------------------------------------
    'OKAY, Lets set up the registers.....
        OSCCON=%01110000                                    'Sleep mode when sleep instr, 8MHz, System clock is via CONFIG BITS
    '    OSCTUNE.6=1                                         'PLL ENABLED
    '---------------------------------------------------------------------------------------
    'Direction registers
        TRISA = %11111111                                   'Set PORTA for all OUTPUTs
        TRISB = %11011111                                   'PORTB is INPUT, except for RB5 
        TRISC = %10010011                                   'Mixed 
        TRISD = %00101110                                   'Mixed
        TRISE = %00000000                                   'Set PORTE for all OUTPUTS
        TRISF = %11111000                                   'Set PORTF for use with comparitor direction  
        TRISG = %10000000                                   'Set PORTG for all OUTPUTS, PORTD pullups ENABLED   
    '---------------------------------------------------------------------------------------- 
    '    ODCON1_ALT = 0                                          'DISABLES open drain outputs
    '    ODCON2_ALT = 0                                          'DISABLES open drain outputs
    '    ODCON3_ALT = 0                                          'DISABLES open drain outputs                
    '----------------------------------------------------------------------------------------    
    
    '----------------------------------------------------------------------------------------
    'Assembly routine for the heartbeat LED, get vitals update
    ASM
    INT_LIST  macro     ; IntSource,     Label,           Type, ResetFlag?
            INT_Handler   TMR0_INT,   _ToggleHeartBeat,    PBP,   yes
        endm
        INT_CREATE                                                                  ; Creates the interrupt processor
    ENDASM
    T0CON=%10000100                                                                 'TMR0 enabled, 16 bit mode, use CLK0 (internal)
                                                                                    'Low to High transition, use prescaler of 1:32
    'T4CON=%01111111                                                                 '1:16 postscale, 1:16 prescaler, Timer4 is enabled
    @    INT_ENABLE  TMR0_INT                                                       ;enable Timer0 interrupts
    
    '-----------------------------------------------------------------------------------------------------------------------
    '****Here is my SPI Setup****
    'This is for the 1st SPI comm - used here for the MRF RF module
        SSP1STAT.7 = 0                                      'SMP=0, sample phase
        SSP1STAT.6 = 1                                      'CKE=1, xmits on rising edge
        SSP1CON1.5=1                                        'enable SPI
        SSP1CON1.4=0                                        'CKP=0, clk idles low
        SSP1CON1.3=0                                        'bit 3 to 0 indicate clock speed. bit 0 set means clock = OSC/4 
        SSP1CON1.2=0
        SSP1CON1.1=0
        SSP1CON1.0=0
        PIR1.3 = 0                                          'Clear the buffer status. 
    '-----------------------------------------------------------------------------------------
        DEFINE DEBUG_REG    PORTC
        DEFINE DEBUG_BIT    6
        DEFINE DEBUG_BAUD   38400
        DEFINE DEBUG_MODE   0
    '-----------------------------------------------------------------------------------------    
    
    '-----------------------------------------------------------------------------------------    
    'Additional I/O Definitions
            Active          var PORTD.0                                             'Active LED, Active LOW
            MRFReset        var PORTA.1                                             'MRF module reset
            MRFDataSel      var PORTA.4                                             'MRF module serial interface data chip select, active LOW
            MRFConfigSel    var PORTA.5                                             'MRF module serial interface configure chip select, active LOW
            MRFIrq0         var PORTB.0                                             'MRF module interupt 0
            MRFIrq1         var PORTC.2                                             'MRF module interupt 1
    '------------------------------------------------------------------------------------------
    'Variable List
            i               var byte  
            RF_Init_Values  var byte[32]                                            'An array to initialize the RF unit
            MRFSPIdata      var byte                                                'Data to/from MRF module
     '------------------------------------------------------------------------------------------
    'Constants here
         RF_Init_Values[0] = $28                                                   'Standby mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
         RF_Init_Values[1] = $8C                                                   'FSK, max IF gain, Packet Mode
         RF_Init_Values[2] = $01                                                   '200KHz Freq Dev
         RF_Init_Values[3] = $63                                                   '2KBps
         RF_Init_Values[4] = $0C                                                   'for OOK mode, not apliable
         RF_Init_Values[5] = $0F                                                   '16Bytes FIFO, 10Bytes threshold transmit interrupt
         RF_Init_Values[6] = $77                                                   '915MHz R1 Reg
         RF_Init_Values[7] = $64                                                   '915MHz P1 Reg
         RF_Init_Values[8] = $32                                                   '915MHz S1 Reg
         RF_Init_Values[9] = $74                                                   '920MHz R2 Reg
         RF_Init_Values[10] = $62                                                  '920MHz P2 Reg
         RF_Init_Values[11] = $32                                                  '920MHz S2 Reg
         RF_Init_Values[12] = $38                                                  'config mode for OOK, not apliable
         RF_Init_Values[13] = $00                                                  'interrupts by default
         RF_Init_Values[14] = $00                                                  '
         RF_Init_Values[15] = $01                                                  '
         RF_Init_Values[16] = $A3                                                  'default filters config
         RF_Init_Values[17] = $38                                                  'default filters config
         RF_Init_Values[18] = $30                                                  'sync word ON, 24bits, 0 errors tolerance
         RF_Init_Values[19] = $00                                                  'reserved reg
         RF_Init_Values[20] = $00                                                  'RSII status read register, 0.5dB / bit
         RF_Init_Values[21] = $00                                                  'OOK config reg
         RF_Init_Values[22] = $53                                                  '"S" 1st byte of sync word
         RF_Init_Values[23] = $59                                                  '"Y" 2nd byte of sync word
         RF_Init_Values[24] = $44                                                  '"D" 3rd byte of sync word
         RF_Init_Values[25] = $00                                                  '
         RF_Init_Values[26] = $70                                                  'utoff fcy = 200KHz, output power = 13dBm 0b000
         RF_Init_Values[27] = $BC                                                  'clk out by default 427KHz
         RF_Init_Values[28] = $02                                                  '3 bytes payload
         RF_Init_Values[29] = $01                                                  'initial MAC ADDRESS, only for test
         RF_Init_Values[30] = $5E                                                  'Fix Packet Lenght, 3 bytes preamble, whitening ON, CRC ON, Node ADDR|0x00|0xFF filtering
         RF_Init_Values[31] = $00                                                  'FIFO autocreal enable if CRC fails, Write to FIFO in stby mode     for (i = 0; i < 32; i++)
    
    'Push all the registers to the MRF and check that each one is written correctly
      
    '---------------------------------------------------------------------------------------------
        goto Init                                           'Steps around subroutines
    '---------------------------------------------------------------------------------------------
    'Subroutines Here-
    
    Write_MRF_SPIData:
                 MRFDataSel=0                                                       'Select the chip
                 SSP1BUF = MRFSPIdata
                 while !PIR1.3 : wend
                 PIR1.3=0                                                           'Reset the flag
                 SSP1CON1.7=0                                                       'Clear collision bit
                 MRFDataSel=1                                                       'Deselect the chip
                 return 
    
    Write_MRF_SPIConfig:
                 MRFConfigSel=0                                                     'Select the chip
                 SSP1BUF = MRFSPIdata
                 while !PIR1.3 : wend
                 PIR1.3=0                                                           'Reset the flag
                 SSP1CON1.7=0                                                       'Clear collision bit
                 MRFConfigSel=1                                                       'Deselect the chip
                 pauseus 1
                 return 
    
    Read_MRF_SPIConfig:                         'NOT FINISHED!!!
                 MRFConfigSel=0                                                     'Select the chip
                 MRFSPIdata = SSP1BUF                                                'Equate buffers
                 while SSP1STAT.0=0 : wend
                 return           
    
    MRF_Sleep:  MRFSPIdata=%00001000                                                 'SLEEP command
                gosub Write_MRF_SPIConfig                                            'Send command to MRF
                return
                
    MRF_Wake:   MRFSPIdata=%00001001                                                 'Standby command
                gosub Write_MRF_SPIConfig                                            'Send command to MRF
                return
                
    MRF_Init:   'Doesn't seem to work, hangs at the read used for verification
                debug "at MRF Initialize", 10, 13
                For i=0 to 31                                                       'Setup counter var to step through all regisiters
                MRFSPIdata=i                                                         'Sets up the address
                gosub Write_MRF_SPIConfig                                           'Send the address to MRF
                debug "1st write reg=",hex2 i,10,13
                MRFSPIdata=RF_Init_Values[i]                                         'Gets value for regisiter
                gosub Write_MRF_SPIConfig                                           'Send the data to MRF
                debug "2nd write data=",hex2 RF_Init_Values[i],10,13
                gosub Read_MRF_SPIConfig                                            'Read it back
                debug "MRF Config data: ",dec2 i," Reg     Data=", hex2 MRFSPIdata,10,13
                next i                                                              'Do for all addresses and all data
                return
                
    '#########################################################################################################################
    '#	Hookay Boyz, We are going to start this Pig!
    '#########################################################################################################################
    init:
                Active=1                                                            'LEDs OFF
                HVEn=0 : HVSel=0                                                    'Booster OFF
                MRFConfigSel=1                                                      'MRF config deselected
                MRFDataSel=1                                                        'MRF data deselected
    
    'MRF initialization here
                 SSP1CON1.7=0                                                       'Clear collision bit
                 PIR1.3=0                                                           'Reset the flag
    MRFinit:     gosub MRF_Init                                                     'Sets up all the registers (I hope)
    
    main:        'Put stuff in here when module works
                 goto main
                
                
                
                
                stop
    
    '---[TMR0 - interrupt handler]---(Heartbeat)------------------------------------
    ToggleHeartBeat:
                      toggle Active
                      @   INT_RETURN
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

  2. #2
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Ha, just got a stupid config direction error, still 'hangs' when reading back from the MRF.
    New register data here:
    TRISA = %00001001 'Set PORTA for mixed

    Regards,
    Steve
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

  3. #3
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    OK-
    The radio is still not working, and I have switched over to the SHIFTIN and SHIFTOUT to try .......
    When I try to read back from the module, it is not what I thought I wrote, so I don't know if my writing or reading is wrong.
    Anyone used this module sucessfully?
    Code below:
    Code:
    'PIC is PIC18F66J11
    'Using PBP3 GOLD 3.0.7.0
    'Microcode Studio Plus 5.0.0.5
    #CONFIG
        CONFIG  WDTEN = OFF           ; WDT NOT enabled
        CONFIG  STVREN = ON           ; Reset on stack overflow/underflow enabled
        CONFIG  XINST = OFF           ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
        CONFIG  DEBUG = OFF           ; Background debugger disabled; RB6 and RB7 configured as general purpose I/O pins
        CONFIG  CP0 = OFF             ; Program memory is not code-protected
    ;    CONFIG  FOSC = INTOSC	  ; Internal oscillator, port function on RA6 and RA7 
        CONFIG  FOSC = INTOSCPLL	  ; INTOSC with PLL enabled, port function on RA6 and RA7
        CONFIG  FCMEN = OFF           ; Fail-Safe Clock Monitor disabled
        CONFIG  IESO = OFF            ; Two-Speed Start-up disabled
        CONFIG  WDTPS = 512           ; 1:512
        CONFIG  CCP2MX = DEFAULT      ; ECCP2/P2A is multiplexed with RC1
        CONFIG  MSSPMSK = MSK7        ; 7-Bit Address Masking mode enable
    #ENDCONFIG
    Asm
        ERRORLEVEL -306
    Endasm
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    'Define the oscillator, INCLUDE files, A2D setup
        DEFINE  OSC 8					'8 MHz oscillator, internal x 4 via PLL = 32MHz  
        include "modedefs.bas"
        INCLUDE "DT_INTS-18.bas"                                                    'Base Interrupt System
        INCLUDE "ReEnterPBP-18.bas"                                                 'Include if using PBP interrupts
    '    DEFINE RX2_INT PIR4,RC2IF,PIE4,RC2IE                'Used to ADD the 2nd serial port to the interrupt scheme
    
    '---------------------------------------------------------------------------------------
    'OKAY, Lets set up the registers.....
        OSCCON=%01110000                                                            'Sleep mode when sleep instr, 8MHz, System clock is via CONFIG BITS
    '    OSCTUNE.6=1                                         'PLL ENABLED
    '---------------------------------------------------------------------------------------
    'Direction registers
        TRISA = %00001001                                                           'Set PORTA for mixed
        TRISB = %11011111                                                           'PORTB is INPUT, except for RB5 
        TRISC = %10010011                                                           'Mixed 
        TRISD = %00101110                                                           'Mixed
        TRISE = %00000000                                                           'Set PORTE for all OUTPUTS
        TRISF = %11111000                                                           'Set PORTF for use with comparitor direction  
        TRISG = %10000000                                                           'Set PORTG for all OUTPUTS, PORTD pullups ENABLED   
    '----------------------------------------------------------------------------------------    
        DEFINE  ADC_BITS 10                                                         '10-bit resolution
        DEFINE  ADC_SAMPLEUS 50                                                     'Sample time in uS before A/D conversion is started
    '    Quanta  CON 1251                                                            ' For 10-bit A/D +Vref = 5V : 5V/1023*256=1.251=Quanta
        ANCON0_ALT = %11110111                                                      'AN2 as ANALOG input, rest are DIGITAL
        ANCON1_ALT = %11111111                                                      'Rest of inputs set as DIGITAL
        ADCON0 = %00001101                                                          'Use Vss&Vdd, sel AN3, enable A2D module
        ADCON1 = %10010001                                                          'RIGHT justified, 4 TAD A2D aq time select, Fosc/8
    
    '----------------------------------------------------------------------------------------
    'Assembly routine for the heartbeat LED, get vitals update
    ASM
    INT_LIST  macro     ; IntSource,     Label,           Type, ResetFlag?
            INT_Handler   TMR0_INT,   _ToggleHeartBeat,    PBP,   yes
        endm
        INT_CREATE                                                                  ; Creates the interrupt processor
    ENDASM
    T0CON=%10000100                                                                 'TMR0 enabled, 16 bit mode, use CLK0 (internal)
                                                                                    'Low to High transition, use prescaler of 1:32
    'T4CON=%01111111                                                                 '1:16 postscale, 1:16 prescaler, Timer4 is enabled
    @    INT_ENABLE  TMR0_INT                                                       ;enable Timer0 interrupts
    '-----------------------------------------------------------------------------------------    
    'Additional I/O Definitions
            SDO             var PORTC.5
            SDI             var PORTC.4
            SCLK            var PORTC.3
            Active          var PORTD.0                                             'Active LED, Active LOW
            MRFReset        var PORTA.1                                             'MRF module reset
            MRFDataSel      var PORTA.4                                             'MRF module serial interface data chip select, active LOW
            MRFConfigSel    var PORTA.5                                             'MRF module serial interface configure chip select, active LOW
            MRFIrq0         var PORTB.0                                             'MRF module interupt 0
            MRFIrq1         var PORTC.2                                             'MRF module interupt 1
    '------------------------------------------------------------------------------------------
    'Variable List
            i               var byte  
            Volts           Var Word                                                'Voltage
            ADval           VAR WORD                                                'A/D conversion result
            RF_Init_Values  var byte[32]                                            'An array to initialize the RF unit
            MRFSPIdata      var byte                                                'Data to/from MRF module
            MRFregister     var byte                                                'MRF register we want to read/write
     
     '------------------------------------------------------------------------------------------
    'Constants here
         RF_Init_Values[0] = $28                                                   'Standby mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
         RF_Init_Values[1] = $8C                                                   'FSK, max IF gain, Packet Mode
         RF_Init_Values[2] = $01                                                   '200KHz Freq Dev
         RF_Init_Values[3] = $63                                                   '2KBps
         RF_Init_Values[4] = $0C                                                   'for OOK mode, not apliable
         RF_Init_Values[5] = $0F                                                   '16Bytes FIFO, 10Bytes threshold transmit interrupt
         RF_Init_Values[6] = $77                                                   '915MHz R1 Reg
         RF_Init_Values[7] = $64                                                   '915MHz P1 Reg
         RF_Init_Values[8] = $32                                                   '915MHz S1 Reg
         RF_Init_Values[9] = $74                                                   '920MHz R2 Reg
         RF_Init_Values[10] = $62                                                  '920MHz P2 Reg
         RF_Init_Values[11] = $32                                                  '920MHz S2 Reg
         RF_Init_Values[12] = $38                                                  'config mode for OOK, not apliable
         RF_Init_Values[13] = $00                                                  'interrupts by default
         RF_Init_Values[14] = $01                                                  '
         RF_Init_Values[15] = $00                                                  '
         RF_Init_Values[16] = $A3                                                  'default filters config
         RF_Init_Values[17] = $38                                                  'default filters config
         RF_Init_Values[18] = $30                                                  'sync word ON, 24bits, 0 errors tolerance
         RF_Init_Values[19] = $00                                                  'reserved reg
         RF_Init_Values[20] = $00                                                  'RSII status read register, 0.5dB / bit
         RF_Init_Values[21] = $00                                                  'OOK config reg
         RF_Init_Values[22] = $53                                                  '"S" 1st byte of sync word
         RF_Init_Values[23] = $59                                                  '"Y" 2nd byte of sync word
         RF_Init_Values[24] = $44                                                  '"D" 3rd byte of sync word
         RF_Init_Values[25] = $00                                                  '
         RF_Init_Values[26] = $70                                                  'utoff fcy = 200KHz, output power = 13dBm 0b000
         RF_Init_Values[27] = $BC                                                  'clk out by default 427KHz
         RF_Init_Values[28] = $02                                                  '3 bytes payload
         RF_Init_Values[29] = $01                                                  'initial MAC ADDRESS, only for test
         RF_Init_Values[30] = $5E                                                  'Fix Packet Lenght, 3 bytes preamble, whitening ON, CRC ON, Node ADDR|0x00|0xFF filtering
         RF_Init_Values[31] = $00                                                  'FIFO autocreal enable if CRC fails, Write to FIFO in stby mode     for (i = 0; i < 32; i++)
    
    'Push all the registers to the MRF and check that each one is written correctly
      
    
    '---------------------------------------------------------------------------------------------
    init:       MRFReset=0                                                          'MRF reset is active HIGH
                Active=1                                                            'LEDs OFF
                HVEn=0 : HVSel=0                                                    'Booster OFF
                MRFConfigSel=1                                                      'MRF config deselected
                MRFDataSel=1                                                        'MRF data deselected
                MRFSPIdata=0
    'MRF initialization here
                MRFConfigSel=0                                                      'Select the chip       
                for i=0 to 31
                    SHIFTOUT SDO, SCLK, 1,[i,RF_Init_Values[i]]                        'send data to register
                    pauseus 100
                next i
                for i=0 to 31
                    SHIFTOUT SDO, SCLK, 1,[i]                                           'Address to read
                    SHIFTIN SDI, SCLK, 0,[MRFSPIdata]                                   'Get data from reg
                    debug "MRF Config data: Register ", hex2 i, "   Data=", hex2 MRFSPIdata,13
                    pauseus 100
                next i
                MRFConfigSel=1                                                      'Deselect the chip
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

  4. #4
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Haven't used this part, but if you could post your results perhaps we might be able to shed some light.
    Maybe post the capture of your debug output.
    Regards,
    TABSoft

  5. #5
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Also I think you need to release the CSCON line (MFRConfigSel=1) after you write the initialization values and before you try to read them back.

    From the DS.

    The new value of the register is effective from the rising edge of CSCON.

    When writing more than one register successively, it is not compulsory to toggle CSCON back high between two write sequences. The bytes are alternatively considered as address and value. In this instance, all new values will become effective on rising edge of CSCON.
    Regards,
    TABSoft

  6. #6
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    I could be completely wrong here but it looks like it uses 5 bit addresses for the config registers.

    Looking through the MRF89XA Datasheet further in section 2.11.1 (SPI CONFIG), figures 2-12 (Write Register Sequence) and 2-13 (Read Register Sequence) on page 24, it looks like the address bytes only use 5 bits for the address and 2 bits for a preamble and 1 bit for a postamble for a total of 8 bits.

    The Preamble bits look to be the following:
    Bit 1: is a start bit and it is a 0
    bit 2: is a R/W bit. 0=Write, 1=Read

    The Postamble Stop Bit is a 0

    So, if I interpret the timing diagrams correctly if you are trying to Write to register 0x00 your address byte will be 0x00. But, to read Register 0x00 your address byte will be 0x40 (%01000000) noting that the DS states all data is received and sent MSB first.
    Bit 7: Start bit = 0
    Bit 6: R/W bit = 1
    Bit 5: Address bit 4 = 0
    Bit 4: Address bit 3 = 0
    Bit 3: Address bit 2 = 0
    Bit 2: Address bit 1 = 0
    Bit 1: Address bit 0 = 0
    Bit 0: Stop bit = 0

    Carrying on further, if you want to Write to and Read from register 0x09, I think these are the address byte values to use.

    Register 0x09
    Write: 0x12 (%00010010)
    Bit 7: Start bit = 0
    Bit 6: R/W bit = 0
    Bit 5: Address bit 4 = 0
    Bit 4: Address bit 3 = 1
    Bit 3: Address bit 2 = 0
    Bit 2: Address bit 1 = 0
    Bit 1: Address bit 0 = 1
    Bit 0: Stop bit = 0


    Read:0x52 (%01010010)
    Bit 7: Start bit = 0
    Bit 6: R/W bit = 1
    Bit 5: Address bit 4 = 0
    Bit 4: Address bit 3 = 1
    Bit 3: Address bit 2 = 0
    Bit 2: Address bit 1 = 0
    Bit 1: Address bit 0 = 1
    Bit 0: Stop bit = 0

    If these assumptions are correct you can just AND your address with with the appropriate mask for the preamble and postamble bits for Write or Read.

    Hope I am not taking you down a rabbit hole....
    Regards,
    TABSoft

Similar Threads

  1. Interfacing LC75854
    By MR2010 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 18th July 2010, 03:42
  2. Keypad Interfacing
    By uaf5000 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th June 2010, 03:35
  3. Interfacing with the ISD4003
    By lerameur in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd June 2008, 16:25
  4. SPI Interfacing
    By toofastdave in forum Serial
    Replies: 8
    Last Post: - 18th November 2007, 12:15
  5. interfacing LCD
    By husakhalid in forum mel PIC BASIC
    Replies: 3
    Last Post: - 30th May 2006, 23:53

Members who have read this thread : 2

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