Announcement

Collapse
No announcement yet.

Problem with Si470x FM Radio Module ( Darrel Taylor example)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Si470x FM Radio Module ( Darrel Taylor example)

    Hi!
    I try to make a radio based on Si470x FM Radio Module example.
    I used PIC16F690 and a LCD Display.
    My code was compiled successfully and worked fine on Proteus simulator but in real word LCD display (Reystar rc1602b) was frozen.
    When I commented the line:
    Code:
    INCLUDE "Si470x.pbpmod"  : CHECK_VERSION $11 ; requires Si470x  ver. 1.1
    the display start working and display the correct message, both in Proteus and in real world.
    I don't understand what happened.
    This is my code:
    Code:
    'PIC16F690
    'PicBasic Pro Trial Edition 3.0.7.0
    #CONFIG
        __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF & _BOREN_OFF
    #ENDCONFIG
    DEFINE OSC 8
    OSCCON = %01110101         ; internal oscillator @ 8 Mhz
    ANSEL  = %00000000         ; All Digital
    ANSELH = %00000000
    TRISA = %11111111
    TRISB = %00000000
    TRISC = %00000000
    
    'Once you have the chip running, here's a simple program that will get the radio working too.
    'Change the TUNE frequency to a station in your area.
    
    'Code:
    ;----[Change these to match your hardware]--------------------------------------
        Si470X_SDA      VAR PORTC.2
        Si470X_SCL      VAR PORTC.3
        Si470X_RST      VAR PORTC.4
        RDS_LED         VAR PORTC.1   ; Optional LED, comment if not used
        STEREO_LED      VAR PORTC.0   ; Optional LED, comment if not used
        LED_POLARITY    CON 1         ; 0=Active LOW, 1=Active HIGH
        #DEFINE USE_PRESETS 10       ; use EEPROM station presets 0, 10 or 20
        INCLUDE "Si470x.pbpmod"  : CHECK_VERSION $11 ; requires Si470x  ver. 1.1      
    
    '-[The connection between the LCD display and the microcontroller is as follows:]-
        ' Define LCD pins
        DEFINE LCD_DREG PORTB 'LCD data port 
        DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4 
        DEFINE LCD_RSREG PORTC 'LCD register select port 
        DEFINE LCD_RSBIT 7 'LCD register select bit       - RS
        DEFINE LCD_EREG PORTC 'LCD enable port 
        DEFINE LCD_EBIT 6 'LCD enable bit                 - E
        DEFINE LCD_BITS 4 'LCD bus size 4 or 8 
        DEFINE LCD_LINES 2 'Number lines on LCD 
        DEFINE LCD_COMMANDUS 2000 'Command delay time in us 
        DEFINE LCD_DATAUS 50 'Data delay time in us 
    
    ;-----[Joystick Connections]----------------------------------------------------
        UP_BUTT      VAR PORTA.0
        CENTER_BUTT  VAR PORTA.1
        LEFT_BUTT    VAR PORTA.2
        DN_BUTT      VAR PORTA.4
        RIGHT_BUTT   VAR PORTA.5
        
        UP_VAR       VAR BYTE             ; Button command Variables
        DN_VAR       VAR BYTE
        LEFT_VAR     VAR BYTE
        RIGHT_VAR    VAR BYTE
        CENTER_VAR   VAR BYTE
    
    '---[Hello World]---------------------------------------------------------------
        PORTB = 0     ' RDS si STEREO Leds shut
        PORTC = 0  
        LCDOUT $FE,1 ' Clear LCD
        LCDOUT $FE,2 ' Home cursor
    Display:
        'Display initial screen
        lcdout $FE,2,"AM/FM RADIO",$fe, $C0,"Test @2014"  
        pause 1000
    goto Display
    
    ;----[Initialization]-----------------------------------------------------------
    ...and so on!

  • #2
    Well, for starters ...
    The radio is connected to PORTC, you've set TRISC to all outputs, then set PORTC to all 0's.

    That's not a good thing to do to an I2C bus.
    Especially when it uses I2C_HOLD.

    That by itself will cause the program to lock up.
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but microchip.com

    Comment


    • #3
      Thank you very much, Darrel.
      I putted the radio pins on PORTA and tested again.
      Still doesn't work.
      The LCD is frozen if the line:
      Code:
      INCLUDE "Si470x.pbpmod"  : CHECK_VERSION $11 ; requires Si470x  ver. 1.1
      is present, even if a led on PORTC.5 is blinking properly.
      If that line is missing, the display start working and display the correct message.
      In Proteus things go well, anyway.
      The SI4735 board is not present yet on my breadboard.

      Code:
      'PIC16F690
      'PicBasic Pro Trial Edition 3.0.7.0
      #CONFIG
          __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF & _BOREN_OFF
      #ENDCONFIG
      
      DEFINE OSC 8
      OSCCON = %01110101         ; internal oscillator @ 8 Mhz
      ANSEL  = %00000000         ; All Digital
      ANSELH = %00000000
      
      TRISC.5 = 0
      'Once you have the chip running, here's a simple program that will get the radio working too.
      'Change the TUNE frequency to a station in your area.
      
      'Code:
      ;----[Change these to match your hardware]--------------------------------------
          Si470X_SDA      VAR PORTA.0 
          Si470X_SCL      VAR PORTA.1 
          Si470X_RST      VAR PORTA.2 
          RDS_LED         VAR PORTA.4 ; Optional LED, comment if not used
          STEREO_LED      VAR PORTA.5 ; Optional LED, comment if not used
          LED_POLARITY    CON 1       ; 0=Active LOW, 1=Active HIGH
          #DEFINE USE_PRESETS 10      ; use EEPROM station presets 0, 10 or 20
          INCLUDE "Si470x.pbpmod"  : CHECK_VERSION $11 ; requires Si470x  ver. 1.1      
      
      '-[The connection between the LCD display and the microcontroller is as follows:]-
          ' Define LCD pins
          DEFINE LCD_DREG PORTB 'LCD data port 
          DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4 
          DEFINE LCD_RSREG PORTC 'LCD register select port 
          DEFINE LCD_RSBIT 7 'LCD register select bit       - RS
          DEFINE LCD_EREG PORTC 'LCD enable port 
          DEFINE LCD_EBIT 6 'LCD enable bit                 - E
          DEFINE LCD_BITS 4 'LCD bus size 4 or 8 
          DEFINE LCD_LINES 2 'Number lines on LCD 
          DEFINE LCD_COMMANDUS 2000 'Command delay time in us 
          DEFINE LCD_DATAUS 50 'Data delay time in us 
      
      '---[Hello World]---------------------------------------------------------------
          LCDOUT $FE,1 ' Clear LCD
          LCDOUT $FE,2 ' Home cursor
      Display:
          'Display initial screen
          lcdout $FE,2,"AM/FM RADIO",$fe, $C0,"@ 2014."  
          pause 10
      test:
          portc.5 = 0 'this is working!
          pause 500
          portc.5 = 1
          pause 500
          goto test
      end
      Last edited by luxornet; 02-01-2014, 01:01 AM.

      Comment


      • #4
        SI4735 ??
        The program was written for the Si4703.
        It will not work with the SI4735.
        PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
        Never download a PIC datasheet from anywhere but microchip.com

        Comment


        • #5
          Thank you very much, Darrel.
          I was planning to use SI4735 but I have not bought any device SI47xx yet.
          I solved my problem with LCD display!
          I used only PortC for LCD pins D4-D7 instead of using PortB for this, and now LCD is working. But I don't know why...
          Code:
          DEFINE LCD_DREG PORTC 'LCD data port 
          DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
          Maybe you can help me, because I prefer the previous arrangement.
          Last edited by luxornet; 02-01-2014, 11:13 AM.

          Comment

          Working...
          X