need help in Sony S.I.R.C at 20/40 mhz


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2005
    Posts
    3

    Default need help in Sony S.I.R.C at 20/40 mhz

    hi guys

    Accroding to the manual of the PBP at 20mhz the resolution of PULSIN is 2uS.
    but i cant seems to make it work even at 40mhz . But when i used 12mhz xtal or below it work perfectly.

    Is there something im mising here?

    i really need to make it work at 20mhz or 40mhz.



    here is my code:

    Header Var Word ' Header pulse length
    Packet Var Word ' 12-bit IR information
    P_Val Var Byte ' The bit length 60us = 0, 120us = 1
    IR_But Var Byte ' The BUTTON code returned
    IR_Dev Var Byte ' The DEVICE code returned
    Sony_LP Var Byte ' Temporary loop variable
    Green_LED Var PortA.1 ' Assign the red LED to this pin

    TRISA = 0
    LOW Green_LED

    START:

    GOSUB IRIN
    IF IR_But = 0 THEN HIGH Green_LED

    GOTO START

    IRIN:
    IR_Dev=255:IR_But=255
    Pulsin PortB.2,0,Header ' Measure the header length.

    If Header < 1000 then Return ' Verify a good header
    If Header > 1350 then Return ' If not valid then exit

    For Sony_Lp=0 to 11 ' Do 12-bits

    Pulsin PortA.2,0,P_Val ' Receive the IR bit pulse
    If P_Val >= 450 then ' If it's >= 90 then we've received a 1
    Packet.0[Sony_Lp]=1 ' So set the appropriate bit of PACKET
    Else
    Packet.0[Sony_Lp]=0
    Endif
    Next

    ' Split the 7-bit BUTTON code, and the 5-bit DEVICE code

    IR_But=Packet & %01111111 ' Mask the 7 BUTTON bits

    IR_Dev=(Packet >>7) & %00011111 ' Move down and mask, the 5 DEVICE bits
    Return



    sorry for my english.

    best regards,
    ferds

  2. #2
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Hi,

    PBP defaults to 4 MHz operation of the device. If you are using anything else, you need to define it, or your timings would all be off in proportion.

    Regards,

    Anand

  3. #3
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default Timings in your code are wrong....

    It may just be a typo but the timings shown in your code are an order of magnitiude out.

    SONY Timings are as follows

    Header pulse is 2400uS ON 600uS OFF
    Logic One is 1200uS ON 600uS OFF
    Logic Zero is 600uS ON 600uS OFF

    You show a "1" as 120uS and a "0" as 60uS

    Remember also that the signal you are receiving will be a modulated 40kHz carrier and you need an IR Receiver Module to give you a demodulated signal which is normally ACTIVE LOW.

    Pulsein varies with OSC frequency so ensure that you correctly define the OSC and allow for the fact that at higher frequencies the count for a given pulse length will be greater.

    eg as Sony is based on a 600uS timeframe then Pulsin would be

    4MHz = 10uS resolution = Count of 60, 120, 240
    10MHz = 4uS resolution = Count of 150, 300, 600
    20MHz = 2uS resolution = Count of 300, 600, 1200
    40MHz = 1uS resolution = Count of 600, 1200, 2400

    Use those values as the centre values for your acceptance window eg @ 20MHz 270-330, 540-660, 1080-1320 allowing a 10 percent tollerance.

    Hope that helps

    Keith
    Keith

    www.diyha.co.uk
    www.kat5.tv

  4. #4
    Join Date
    May 2005
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    DEFINE LOADER_USED 1
    DEFINE OSC 4

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_SPBRG 12 ' 19200 Bauds

    Header Var Word ' Header pulse length
    Packet Var Word ' 12-bit IR information
    P_Val Var Byte ' The bit length 60us = 0, 120us = 1
    IR_But Var Byte ' The BUTTON code returned
    IR_Dev Var Byte ' The DEVICE code returned
    Sony_LP Var Byte ' Temporary loop variable
    Green_LED Var Portb.3 ' Assign the red LED to this pin
    IR_bin var word

    TRISA = 0
    LOW Green_LED

    START:

    GOSUB IRIN
    IF IR_But =255 THEN start

    HSEROUT ["IR_But ",DEC IR_But,13,10]
    HSEROUT ["IR_Dev ",DEC IR_Dev,13,10]

    GOTO START

    IRIN:
    IR_Dev=255:IR_But=255

    Pulsin PortB.0,0,Header ' Measure the header length.

    If Header < 216 then Return ' Verify a good header
    If Header > 264 then Return ' If not valid then exit

    For Sony_Lp=0 to 11 ' Do 12-bits

    Pulsin PortB.0,0,P_Val ' Detech 1 Check space pluse ,Receive the IR bit pulse
    If P_Val > 100 then ' If it's >= 90 then we've received a 1
    'Packet.0[Sony_Lp]=1 ' So set the appropriate bit of PACKET
    Packet.0=1
    Else
    'Packet.0[Sony_Lp]=0
    Packet.0=0
    Endif


    Next

    ' Split the 7-bit BUTTON code, and the 5-bit DEVICE code

    IR_But=Packet & %01111111 ' Mask the 7 BUTTON bits

    IR_Dev=(Packet >>7) & %00011111 ' Move down and mask, the 5 DEVICE bits

    Return

    Work well for sony remote

    And now we try to HITACHI remote ,Space(0) type (sony remote , Pulse(1) type)


    Still not work ......What i worng

    '*** IR decode fro Hitachi remote*********

    DEFINE LOADER_USED 1
    DEFINE OSC 4
    'DEFINE OSC 20

    '// For PIC16F62x & A versions
    'CMCON = 7 '// Comparators Off
    'VRCON = 0 '// Vref Off

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_SPBRG 12 ' 19200 Bauds

    Header Var Word ' Header pulse length
    Packet Var Word ' 12-bit IR information
    P_Val Var Byte ' The bit length 60us = 0, 120us = 1
    IR_But Var Byte ' The BUTTON code returned
    IR_Dev Var Byte ' The DEVICE code returned
    Sony_LP Var Byte ' Temporary loop variable
    Green_LED Var Portb.3 ' Assign the red LED to this pin
    IR_bin var word

    TRISA = 0
    LOW Green_LED

    START:

    GOSUB IRIN
    IF IR_But =255 THEN start

    HSEROUT ["Bottom ",DEC IR_But,13,10]
    HSEROUT ["Comand ",DEC IR_Dev,13,10]

    GOTO START

    IRIN:
    IR_Dev=255:IR_But=255

    Pulsin PortB.0,0,Header ' Measure the header length.

    If Header < 704 then Return ' Verify a good header
    If Header > 968 then Return ' If not valid then exit
    PAUSEUS 240 'wait for header space

    For Sony_Lp=0 to 31 ' Do 32-bits

    Pulsin PortB.0,1,P_Val ' Detech 1 Check space pluse ,Receive the IR bit pulse
    If P_Val > 150 then ' If it's >= 90 then we've received a 1
    Packet.0[Sony_Lp]=1 ' So set the appropriate bit of PACKET
    Else
    Packet.0[Sony_Lp]=0
    Endif

    Next

    ' Split the 7-bit BUTTON code, and the 5-bit DEVICE code

    'IR_But=Packet & %01111111 ' Mask the 7 BUTTON bits
    IR_But=Packet.highbyte
    'IR_Dev=(Packet >>7) & %00011111 ' Move down and mask, the 5 DEVICE bits
    IR_Dev=Packet.highbyte
    Return

    Hitachi pluse detail , 32 bit , space type
    IR head = 8800(+) , 2200 (-)
    1 = 550(+) , 1650 (-)
    0 = 550(+) , 550 (-)

    Still not work ......What i wrong..

  5. #5
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Your code shows "DEFINE OSC 4", while your original post suggests you are trying to use a 20MHz crystal; if the crystal is actually 20MHz, change your define accordingly. If on the other hand it is 4 MHz, the define is not really required as PBP defaults to that anyway.

    Regards,

    Anand

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. TSA5512/5511 code for PIC16F877/84
    By Marin in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th August 2013, 06:16
  3. Setting up a 12F683 to run at 20 Mhz
    By johnnylynx in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 3rd March 2009, 02:46
  4. Resonator Suppliers for 40 MHz?
    By mcphill in forum General
    Replies: 5
    Last Post: - 23rd January 2009, 02:05
  5. bootloader file 10 mhz
    By emmett brown in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th September 2006, 00:33

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