Saa1057 pll


+ Reply to Thread
Results 1 to 2 of 2

Thread: Saa1057 pll1864 days old

  1. #1
    Junior Member stefano's Avatar
    Join Date
    Dec 2005
    Posts
    51
    Thumbs Up
    Received: 1
    Given: 1
    Total Downloaded
    793.31 MB

    0 Not allowed!

    Default Saa1057 pll

    HI, I have a programming problem of this ic: SAA1057 pll ( info http://www.pira.cz/pdf/SAA1057.pdf )
    This is my code but it does not work ...
    Can you give me some help?

    Thanks and Regards

    Stefano

    Code:
     
    '****************************************************************'*  Name    : saa1057-11.BAS                                      *
    '*  Author  : [Stefano]                                    *
    '*  Notice  : Copyright (c) 2015 [Stefano Homebrew]             *
    '*          : All Rights Reserved                               *
    '*  Date    : 25/04/2015                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
                    Device 16F628A
                    Xtal 4
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                    Declare LCD_Interface 4          ' imposta dati lcd a 4 fili
                    Declare LCD_Lines 2              ' imposta linee lcd
                    Declare LCD_DTPin PORTB.0        ' assegna porta C4 alla DT lcd
                    Declare LCD_ENPin PORTA.3        ' assegna porta B6 alla EN lcd
                    Declare LCD_RSPin PORTA.2       ' assegna porta B5 alla RS lcd
                    All_Digital true
    
    
                    Dim mem2 As Byte
                    Dim mem1 As Byte
                    Dim frequenza As Word
                    Dim ultimafreq As Word
                    Dim frequenzaR As Word
                    
                    Symbol Up = PORTA.0
                    Symbol Down = PORTA.1
                    Symbol lock = PORTA.4
                    Symbol clb = PORTB.4
                    Symbol dlen = PORTB.5 
                    Symbol dataa = PORTB.6
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''
                    TRISA.0 = 1
                    TRISA.1 = 1
                    TRISA.4 = 1
                    TRISB.4 = 0
                    TRISB.5 = 0
                    TRISB.6 = 0
                    clb = 0
                    dlen = 0
                    dataa = 0
                    
                    DelayMS 200
    
    
    '  WordB   01110110010101
    '0101    'Controllo del  pin 18 
                '0000=1; 0001= contatore prg; 0100=Frec. Ref.; 0101=Lock/Unlock
    '1          BRM controllo del bus  1 = sw automatico;  0 = sempre in ON
    '00         PDM Detector di fase digital 0X = on/off automatico; 10 = on; 11 = off 
    '1          SLA Modo  Latch A  1 = síncrono; 0 = asíncrono
    '1          SB2 on/off ultimi 8 bits della wordB 1 = on; 0 = off.
                '(da SLA a T0)  0, gli ultimi 8 bit sono collocati in 00000000
    '1110       Guadagno di corrente per la tensione di errore 0000=0.023; 0001=0.07; 0010=0.23; 0110=0.7; 1110=2,3
    '0          Freq.rifermento 0 = 1Khz; 1 = 1.25Khz
    '1          modo FM/AM; 1 = FM; 0 = AM
              
                    
                    EWrite 0,[232,3,0]   ' EEPROM   3,232 = 1000 = 100.0 Mhz  
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''   
                    mem1  = ERead 0         
                    mem2  = ERead 1               
                    frequenza = mem2 * 256 +mem1      
                    ultimafreq = frequenza
                    Low dlen
                    DelayMS 100
                    Print At 1,1,"TEST PLL 1      "
                    DelayMS 1000                           'wait
                     Cls
                    
                   '''''''Write WordB  SAA1057
    
    
                   dlen = 1
                   SHOut dataa, clb, 1, [01110110010101]
                   dlen = 0
                   dataa = 0
                   DelayUS 5
                   clb = 1
                   DelayUS 1
                   clb = 0
                   DelayMS 100
                    GoSub wiritefreq    ' write @saa1057
                    GoSub writelcd  'write @ LCD
                    Cls
                    DelayMS 100         
    '*******************START********************
    loopstart:
        GoSub writelcd    
       If Up=1 Then
            DelayMS 200
            frequenza = frequenza + 1
            If frequenza < 1081 Then
                Else
                frequenza = 1080
            EndIf
        EndIf
        
        If Down = 1 Then
            DelayMS 200
            frequenza = frequenza-1
            If frequenza > 874 Then
                Else
                frequenza = 875    
            EndIf
        EndIf
        DelayMS 1
    '''''''''''''''''''''''''''''''    
        If lock = 0 Then
            Print At 1,1, "Unlock"
            lock = 0
        Else
            Print At 1,1, "Lock  "
            lock = 1
        EndIf
    
    
        DelayMS 1
    GoTo loopstart
    '''''''''''''''''''''''''''''''''''write @saa1057
    wiritefreq:
       frequenzaR = frequenza  * 10
       dlen = 1                                          
       SHOut dataa, clb, 1, [frequenzaR\16]
       dlen = 0
       dataa = 0
       DelayUS 5
       clb = 1
       DelayUS 1
       clb = 0
       DelayMS 1
    Return
    '***************************************************
    writelcd:
    
    
        mem1 = frequenza
        mem2 = (frequenza-mem1)/256
        
        If ultimafreq <> frequenza Then     
          EWrite 0, [mem1]              
            EWrite 1, [mem2]          
        EndIf
        GoSub wiritefreq
        If frequenza < 1000 Then
            
            Print At 1,9, Dec (frequenza/10), ".", Dec1 frequenza, "Mhz"
            Print At 2,1,@frequenzaR
        Else
            
            Print At 1,9, Dec (frequenza/10), ".", Dec1 frequenza, "Mhz"
            Print At 2,1,@frequenzaR
        EndIf
    
    
    Return
                    
    End

  2. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,401
    Thumbs Up
    Received: 80
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default Re: Saa1057 pll

    I would first try to both read and write to a register to confirm the protocol assuming the registers for this device are readable.

    I believe dlen should toggle from low to high pre SHOut.
    Also 17 bits of data as the first bit is always 0 then a 0 if data word A or a 1 if data word B then bits <14:0> assuming most significant bit (16) first.

    Norm
    Last edited by normnet; 27th April 2015 at 02:44.

  4. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. PIC18F1330 PLL problem
    By rcurl in forum Proton Plus Compiler v3
    Replies: 14
    Last Post: 24th October 2018, 12:11
  2. Xtal declaration with PLL on
    By yvesmazzon in forum Tips 'n Tricks
    Replies: 1
    Last Post: 25th August 2017, 08:25
  3. 32mhz pll
    By Jezsmith in forum Proton Plus Compiler v3
    Replies: 9
    Last Post: 27th April 2012, 08:21
  4. [SOLVED !] Pll
    By ADLIN SYSTEMS in forum The Lounge
    Replies: 2
    Last Post: 16th February 2012, 19:33
  5. [SOLVED !] PLL Fuse settings
    By picprotonguy in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 11th March 2009, 18:02

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts