Control BH1415 with a 16f88


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302

    Default Control BH1415 with a 16f88

    Until today i have use the pic16f88 to control a TSA 5511.
    My problem now is how to control a BH1415 with pic16f88, because this chip has data - clock and enable.
    I have found code , but is for C ,and i don't now.

    Code:
    int setFreq[] = {1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,0};
    // set the frequency to 102.1 MHz and other config bits for audio IC
    // write_to_chip - write enable, clock, and data bits to audio IC
    void write_to_chip(){
    int i,j;
    PBOUT |= 0x01;
    for(j = 0; j <= 10; j++) // set a clock delay
    asm("nop");
    for(i = 0; i < 16; i++){
    if(setFreq[i] == 1)
    PBOUT |= 0x04; // set data bit
    else PBOUT &= 0xFB;
    for(j = 0; j <= 10; j++) // set clock down delay
    asm("nop");
    PBOUT |= 0x02; // turn clock on
    for(j = 0; j <= 10; j++) // set up clock delay
    asm("nop");
    PBOUT &= 0xFD; // turn clock off
    }
    PBOUT &= 0xFE;
    }

  2. #2


    Did you find this post helpful? Yes | No

    Default

    this should help you convert it even though it is for converting c to proton you should still get the idea
    Attached Files Attached Files

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Try this;
    Code:
    i       var byte
    j       var byte
    setfreq var byte
    PBOUT   var PORTB  ' my assumption here. have no idea what PBOUT is.
    TRISB = 0              ' not sure if this is what you need, but..
    
    Main:
         gosub write_to_chip
         goto Main
    
    write_to_chip:
         PBOUT = PBOUT | 1
         
         for j = 0 to 10
            @ nop
         next j
    
         for i = 0 to 15
            lookup i,[1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,0],setfreq
    
            if setfreq = 1 then
               PBOUT = PBOUT | 4
            else
               PBOUT = PBOUT & $FB
            endif
            
            for j = 0 to 10
               @ nop
            next j
    
            PBOUT = PBOUT | 0x02;
    
            for j = 0 to 10
               @ nop
            next j
    
            PBOUT = PBOUT & $FD
         next i
    
         PBOUT = PBOUT & $FE
         RETURN
    You could probably replace the j loops & nops with pauseus x if you knew the
    time delay required for x.
    Last edited by Bruce; - 7th July 2007 at 21:35.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    This code is from this : http://people.msoe.edu/~mohre/FinalReport.pdf
    and page 17
    Anyone know how to control this chip (BH1415) ;
    Last edited by savnik; - 7th July 2007 at 19:43.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    This code is from this : http://people.msoe.edu/~mohre/FinalReport.pdf
    and page 17
    Anyone know how to control this chip (BH1415) ;
    Do you not have the bh1415f datasheet?
    It explains how to set the frequency in there...all easily done with PBP's SHIFTOUT commands...

    bits 0 - 15
    1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,0

    bits 0-10 = frequency, in this case 102.1Mhz
    bit 11 = mode, in this case stereo
    bits 12-13 = phase detector operation, in this case normal
    bits 14-15 = test mode, in this case normal operation

    It's right there on the last 2 pages of the bh1415f datasheet from ROHM.
    Last edited by skimask; - 7th July 2007 at 20:01.

  6. #6
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Do you not have the bh1415f datasheet?
    It explains how to set the frequency in there...all easily done with PBP's SHIFTOUT commands...

    bits 0 - 15
    1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,0

    bits 0-10 = frequency, in this case 102.1Mhz
    bit 11 = mode, in this case stereo
    bits 12-13 = phase detector operation, in this case normal
    bits 14-15 = test mode, in this case normal operation

    It's right there on the last 2 pages of the bh1415f datasheet from ROHM.
    I have the bh1415f datasheet and i have read , but i don't know how to send the data to bh1415f , because this chip has data,clock and enable
    For the TSA551 i don't have problem.I have use it many times , but this have only data and clock and use I2CWRITE SDA,SCL,ADDR1,[HI,LO,$8E] to send the data
    Last edited by savnik; - 7th July 2007 at 20:26.

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    I have the bh1415f datasheet and i have read , but i don't know how to send the data to bh1415f , because this chip has data,clock and enable
    For the TSA551 i don't have problem.I have use it many times , but this have only data and clock and use I2CWRITE SDA,SCL,ADDR1,[HI,LO,$8E] to send the data
    SHIFTOUT SHIFTOUT SHIFTOUT SHIFTOUT

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    I have the bh1415f datasheet and i have read , but i don't know how to send the data to bh1415f , because this chip has data,clock and enable
    For the TSA551 i don't have problem.I have use it many times , but this have only data and clock and use I2CWRITE SDA,SCL,ADDR1,[HI,LO,$8E] to send the data
    Code:
    freq var word
    dataout var word
    hardcode var word
    chipselect var portb.0 'or whatever pin you've got set for the chip select
    datapin var portb.1 'or whatever pin you've got set for the data pin
    clockpin var portb.2 'or whatever pin you've got set for the clock pin
    
    hardcode = %0100100000000000 'hardcoded values - not in test mode, phase detector normal, stereo operation, doesn't (shouldn't?) change
    
    freq = 1021   'frequency desired = 102.1 Mhz
    dataout = hardcode + freq 'add in frequency value
    high chipselect
    shiftout datapin , clockpin , 0 , [ dataout/16 ]
    low chipselect

  9. #9
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    SHIFTOUT SHIFTOUT SHIFTOUT SHIFTOUT
    I have understand , but i don't have use before the command shiftout.

    Code:
        Include "modedefs.bas"
        
    	datapin   var PORTB.0    
    	clockpin  var PORTB.1
            enablepin var PORTB.2
        
        dataout var word
        
        dataout = %1011111111010010
    
        high enablepin
        shiftout datapin , clockpin , 0 , [ dataout\16 ]
        low enablepin
    Last edited by savnik; - 7th July 2007 at 22:16.

  10. #10
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Code:
    freq var word
    dataout var word
    hardcode var word
    chipselect var portb.0 'or whatever pin you've got set for the chip select
    datapin var portb.1 'or whatever pin you've got set for the data pin
    clockpin var portb.2 'or whatever pin you've got set for the clock pin
    
    hardcode = %0100100000000000 'hardcoded values - not in test mode, phase detector normal, stereo operation, doesn't (shouldn't?) change
    
    freq = 1021   'frequency desired = 102.1 Mhz
    dataout = hardcode + freq 'add in frequency value
    high chipselect
    shiftout datapin , clockpin , 0 , [ dataout/16 ]
    low chipselect
    I test today this code but don't work

Similar Threads

  1. How do I give a radio control car autonomous control
    By Kenjones1935 in forum General
    Replies: 190
    Last Post: - 17th January 2010, 15:40
  2. Problem with 16f88 steep motor control
    By ken_23 in forum Off Topic
    Replies: 0
    Last Post: - 4th July 2008, 12:25
  3. Control unlimited servos at the same time
    By mrx23 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th September 2006, 14:14
  4. Stepper motor control using PIC 16F88
    By tonykeys in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd February 2006, 20:09
  5. Control RC servo via Parallax Servo Control
    By cibotsan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2005, 08:18

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