Is anyone willing to work with me to rewrite some code?


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322

    Default Is anyone willing to work with me to rewrite some code?

    Hi All!
    I really wish to get an STV5730 to work with a PIC. The code I was given is way beyond my skills. The code has time, temperature, and computer / keyboard interfaces that are not necessary. I simply need to have a PIC that will do a basic on screen display. I would like to know which code and how to eliminate the extras.

    Code:
    '****************************************************************
    '*  Name    : Overlay.BAS                                       *
    '*  Author  : [Grant Taylor VE3XTV / ZL1WTT]                    *
    '*  Notice  : Copyright (c) 2010                                *
    '*          : All Rights Reserved                               *
    '*  Date    : Start date 30/12/2010                             *
    '*  Version : 6.0                                               *
    '*  Notes   : onging project                                    *
    '*          :                                                   *
    '****************************************************************
    ' Using STV5730A as a video overlay for text information
    ' With a Microcontroller
    
    ' Definitions
    
    DEFINE OSC 20                ' 20 MHz Oscillator frequency
    
    
    
    DEFINE HSER_RCSTA       90h  ' Set receive register to receiver enabled
    DEFINE HSER_TXSTA       20h  ' Set transmit register to transmitter enabled
    DEFINE HSER_BAUD        9600 ' Set baud rate
    Define ADC_BITS	10	         ' Set number of bits in result
    Define ADC_CLOCK 3	         ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50       ' Set sampling time in uS
    
    Dpin  var PORTB.0  ' I2C Data pin
    Cpin  var PORTB.1  ' I2C Clock pin
    DA    VAR PORTB.2  ' Data out 
    CL    VAR PORTB.3  ' Clock out     
    EN    VAR PORTB.4  ' Chip enable or chip select
    
    'Variables
    
    RC    VAR BYTE      ' Row count
    CC    VAR BYTE      ' Character counter
    LC    VAR BYTE      ' Line counter
    wData VAR WORD      ' Write data
    Echo  var byte      ' Storage for serial character
    TAB   VAR BYTE      ' TAB to move across a line
    TP    VAR WORD      ' Temp variable holder
    T     VAR BYTE      ' Time variable holder
    T1    VAR BYTE      ' Time variable holder
    T10   VAR BYTE      ' Time variable holder
    NC    VAR BYTE      ' Number count
    J     VAR WORD      ' Table counter variable
    C     VAR BYTE      ' Counter variable
    Co    VAR BYTE      ' Counter out variable
    L     VAR WORD      ' Line counter
    Sz    VAR BYTE      ' Text size
    H     VAR BYTE      ' Hex number
    AS    VAR BYTE      ' ASCII number
    D     VAR BYTE [28] ' ASCII Digits 
    CS    var byte [7]  ' callsign position array
    Cx    VAR BIT       ' Date bit
    Tx    VAR BIT       ' Date bit
    SumA  VAR BYTE      ' Check output pins
    SumB  VAR BYTE      ' Check output pins 
    AD0   VAR WORD	    ' Create ad0 to store result
    AD1   VAR WORD	    ' Create ad1 to store result
    X     VAR BIT       ' Callsign set bit
    
    Init:
    TRISA = %000011          ' Set as both
    ADCON1 = %00000010	 ' Set PORTA analog and LEFT justify result
    TRISB = %00000011        ' Set as both
    TRISC = %11111111        ' Set as both
    H=$30 : Tx=1 : Cx=0 : X=0
    
    ' STV5730A initialize 
    
    initSTV:
    High Cl :High DA :High EN       ' Start up data
    Pause 250                       ' 250ms wait
    wData=$3000 : GoSub Send        ' Send 3000 in Hex
    wData=$3000 : GoSub Send        ' Send 3000 in Hex
    wData=$00DB : GoSub Send        ' Send 00DB in Hex
    wData=$1000 : GoSub Send        ' Send 1000 in Hex
    wData=$00CC : GoSub Send        ' Init registers (point to register 12)
    wData=$1000 : GoSub Send        ' Zoom
    wData=$1000 : GoSub Send        ' Colour
    wData=$1ACE : GoSub Send        ' Control set to NTSC
    wData=$15A1 : GoSub Send        ' Position
    wData=$183C : GoSub Send        ' Mode
    wData=$00C0 : GoSub Send        ' Set row attributes
    For RC=0 TO 10                  ' Rows from 0 to 10 
    wData=$10C4 : GoSub Send
    Next RC
    CC=0: LC=0                      ' Set line and row to 0
    GOSUB CLS                       ' Clear video screen
    PAUSE 250                       
    CC=0: LC=0                      ' Set line and row to 0
    GOSUB CLS                       ' Clear video screen
    GOTO com_set
    
    CLS:
    wData=lc*256+CC    ' Line and row data
    GoSub Send         ' Send data to STV5730A
    wData=$1F0B        ' Set character to " "
    GoSub Send         ' Send data to STV5730A
    CC=CC+1
    IF CC>=28 Then     ' Max character count of 28
    CC=0               
    lc=LC+1           
    EndIF
    IF Lc=11 THEN      ' Max line count of 11
    RETURN
    ELSE 
    GoTo CLS                       
    ENDIF
    
    Send:         ' Send data to STV5730A
    PAUSEUS 250   ' Deylay of 250 uS
    Low EN        ' Set chip select low   
    GoSub Serial  ' Send 16 bit word
    High EN       ' Set chip select pin high
    High Cl       ' Set clock pin high
    High DA       ' Set data pin high
    Return
    
    Serial:        ' Serial out routine
    DA=wData.15    ' Bring Do pin high or low, depending upon bit	
    PULSOUT CL,1   ' Bring Clock line high and then low
    DA=wData.14    ' Same as above
    PULSOUT CL,1   ' Same as above
    DA=wData.13		
    PULSOUT CL,1
    DA=wData.12		
    PULSOUT CL,1
    DA=wData.11		
    PULSOUT CL,1
    DA=wData.10		
    PULSOUT CL,1
    DA=wData.9		
    PULSOUT CL,1
    DA=wData.8		
    PULSOUT CL,1
    DA=wData.7	    
    PULSOUT CL,1
    DA=wData.6	    
    PULSOUT CL,1
    DA=wData.5		
    PULSOUT CL,1
    DA=wData.4		
    PULSOUT CL,1
    DA=wData.3		
    PULSOUT CL,1
    DA=wData.2		
    PULSOUT CL,1
    DA=wData.1		
    PULSOUT CL,1
    DA=wData.0		
    PULSOUT CL,1	
    Return
    
    PC_time:                                      ' Time comport
    T=0
    I2CREAD Dpin,Cpin,$A3,$02,[T]
    GOSUB Tcon 
    CS[0]=T
    I2CREAD Dpin,Cpin,$A3,$03,[T]
    GOSUB Tcon 
    CS[1]=T  
    I2CREAD Dpin,Cpin,$A3,$04,[T]
    T=T&$3F
    GOSUB Tcon 
    CS[2]=T
    hserout ["Time h,m,s"]
    GOSUB linefeed                                   ' Send text followed by carriage return and linefeed
    GOSUB linefeed                                   ' Carriage return and linefeed
    hserout [DEC CS(2),":",DEC CS(1),".",DEC CS(0)]	 ' Send text followed by carriage return and linefeed
    GOSUB linefeed 
    GOSUB linefeed                                   ' Carriage return and linefeed
    RETURN
    
    PC_date:                                         ' Date comport
    I2CREAD Dpin,Cpin,$A3,$05,[T]
    T=T&$3F
    GOSUB Tcon 
    CS[3]=T
    I2CREAD Dpin,Cpin,$A3,$06,[T]
    T=T&$07
    GOSUB Tcon 
    CS[4]=T
    I2CREAD Dpin,Cpin,$A3,$07,[T]
    T=T&$1F
    GOSUB Tcon 
    CS[5]=T
    I2CREAD Dpin,Cpin,$A3,$08,[T]
    GOSUB Tcon 
    CS[6]=T
    hserout ["Date d,m,y"]                  ' Send text followed by carriage return and linefeed
    GOSUB linefeed 
    GOSUB linefeed                                   ' Carriage return and linefeed
    IF CS[4]=0 THEN hserout ["Sun",13,10]  
    IF CS[4]=1 THEN hserout ["Mon",13,10]
    IF CS[4]=2 THEN hserout ["Tues",13,10]
    IF CS[4]=3 THEN hserout ["Wed",13,10]
    IF CS[4]=4 THEN hserout ["Thurs",13,10]
    IF CS[4]=5 THEN hserout ["Fri",13,10]
    IF CS[4]=6 THEN hserout ["Sat",13,10]
    GOSUB linefeed                                    ' Carriage return and linefeed
    hserout [DEC CS(3),"/",DEC CS(5),"/20",DEC CS(6)] ' Send text followed by carriage return and linefeed
    GOSUB linefeed 
    GOSUB linefeed                                    ' Carriage return and linefeed
    RETURN
    
    Tcon:
    T=T&$7F
    T1 =($0F&T)
    T10=(T/$10)*10
    T=T10+T1
    RETURN 
    
    Set_time:
    T10=(T10-H)*$10
    T1 =T1-H
    Co=T10+T1
    RETURN
    
    vcon:
    CS[1]=T DIG 0     ' Read the position of digit 2
    CS[0]=T DIG 1     ' Read the position of digit 1
    RETURN
    
    v_time:           ' Display time via the video 
    J=J+1
    I2CREAD Dpin,Cpin,$A3,$05,[T]
    T=T&$3F
    SumB=t
    IF Cx=1 AND SumA<>SumB THEN GOSUB v_date
    IF Tx=1 AND J=250 THEN GOSUB Temp
    wData=$700
    GOSUB Send  
    I2CREAD Dpin,Cpin,$A3,$04,[T]
    T=T&$3F
    GOSUB Tcon 
    GOSUB vcon
    for C=0 to 2                   ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$26],Co
    wData=$1300+Co
    gosub Send
    NEXT C 
    I2CREAD Dpin,Cpin,$A3,$03,[T]
    GOSUB Tcon 
    GOSUB vcon
    FOR C=0 to 2                   ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$26],Co
    wData=$1300+Co
    GOSUB Send
    NEXT C 
    I2CREAD Dpin,Cpin,$A3,$02,[T]
    GOSUB Tcon 
    GOSUB vcon
    FOR C=0 to 1                   ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1]],Co
    wData=$1300+Co
    gosub Send
    NEXT C 
    Hserin 40,v_time,[echo]
    IF ECHO=27  THEN 
    GOSUB linefeed 
    hserout ["Exit"] 
    GOSUB linefeed  
    GOSUB linefeed 
    GOSUB CLS
    CC=0: Lc=0 : L=0 : Cx=0 : Tx=0
    RETURN
    ENDIF
    GOTO v_time:
    
    v_date:                        ' Display date via the video
    wData=$800
    gosub Send  
    I2CREAD Dpin,Cpin,$A3,$05,[T]
    T=T&$3F
    SumA=t
    GOSUB Tcon 
    GOSUB vcon
    for C=0 to 2                   ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$28],Co
    wData=$1300+Co
    GOSUB Send
    next C 
    I2CREAD Dpin,Cpin,$A3,$07,[T]
    T=T&$1F
    GOSUB Tcon 
    GOSUB vcon
    for C=0 to 2                   ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$28],Co
    wData=$1300+Co
    GOSUB Send
    next C 
    I2CREAD Dpin,Cpin,$A3,$08,[T]
    GOSUB Tcon 
    GOSUB vcon
    FOR C=0 to 3                   ' Read data out to STV5730A
    LOOKUP2 C,[2,0,CS[0],CS[1]],Co
    wData=$1300+Co
    GOSUB Send
    NEXT C 
    RETURN
    
    Tempcom:                       ' Read temperture 
    GOSUB Tmp1
    IF D(3)=$0B THEN 
    D(3)=32 
    ELSE 
    D(3)=D(3)+H
    ENDIF
    IF D(2)<$0A THEN D(2)=D(2)+H 
    IF D(2)=$0B THEN D(2)=32 
    IF D(2)=$0A THEN D(2)=45 
    hserout ["temp 1 ",D(2),D(3),D(4)+H,"C"]   
    GOSUB linefeed                
    GOSUB Tmp2
    IF D(3)=$0B THEN 
    D(3)=32 
    ELSE 
    D(3)=D(3)+H
    ENDIF
    IF D(2)<$0A THEN D(2)=D(2)+H 
    IF D(2)=$0B THEN D(2)=32 
    IF D(2)=$0A THEN D(2)=45 
    hserout ["temp 2 ",D(2),D(3),D(4)+H,"C"]  
    GOSUB linefeed 
    GOSUB linefeed                       
    RETURN
    
    Temp:                      ' Display Temperture via the video 
    wData=$70C
    gosub Send
    for C=0 to 10              ' Read data out to STV5730A
    LOOKUP2 C,[$1F,$2E,$36,$39,$2E,$3B,$2A,$3D,$3E,$3B,$2E],Co
    wData=$1300+Co
    gosub Send
    next C
    GOSUB Tmp1
    wData=$80C
    gosub Send
    for C=0 to 5             ' Read data out to STV5730A
    LOOKUP2 C,[$1,$0B,D(2),D(3),D(4),$0E],Co
    wData=$1300+Co
    gosub Send
    next C
    GOSUB Tmp2
    wData=$814
    gosub Send
    for C=0 to 5             ' Read data out to STV5730A
    LOOKUP2 C,[$2,$0B,D(2),D(3),D(4),$0E],Co
    wData=$1300+Co
    gosub Send
    next C
    Tx=1
    J=0
    RETURN
    
    Tmp1:
    ADCIN 0,AD0        ' Read ADC one
    Tp=AD0/64
    GOSUB Temp_C
    RETURN
    
    Tmp2:
    ADCIN 1,AD1        ' Read ADC two
    Tp=AD1/64
    GOSUB Temp_C
    RETURN
    
    Temp_C:
    IF Tp>=559 THEN
    J=(Tp-559)*100     ' Calulate out temperture in +
    C=J/205
    ELSE 
    J=(Tp-354)*100     ' Calulate out temperture in -
    C=100-(J/205)           
    ENDIF
    GOSUB AtoDcaL
    RETURN
    
    AtoDcaL:
    D(4)=C DIG 0     ' Read the position of digit 5
    D(3)=C DIG 1     ' Read the position of digit 4
    D(2)=C DIG 2     ' Read the position of digit 3
    D(1)=C DIG 3     ' Read the position of digit 2
    D(0)=C DIG 4     ' Read the position of digit 1
    IF D(0)+D(1)+D(2)+D(3)=0 THEN D(3)=$0B   ' Add space in (Hex B)
    IF D(0)+D(1)+D(2)=0 THEN D(2)=$0B
    IF D(0)+D(1)=0 THEN D(1)=$0B
    IF D(0)=0 THEN D(0)=$0B
    RETURN
    
    ' Comport setup
    
    com_set:
    wData=0 : Sz=0
    L=0 : TAB=0 : J=0
    CC=0: Lc=0 : Cx=0 : Tx=0
    hserout ["Video overlay"]    ' Send text followed by carriage return and linefeed
    GOSUB linefeed 
    hserout ["by Grant VE3XTV"]	 ' Send text followed by carriage return and linefeed
    GOSUB linefeed               ' Carriage return and linefeed
    
    com_start:     ' Comport start up
    IF Sz=0 THEN
    wData=$00CC  
    GoSub Send
    wData=$1000
    GoSub Send
    ENDIF
    IF Sz=1 THEN
    wData=$00CC  
    GoSub Send
    wData=$1555
    GoSub Send
    ENDIF
    IF Sz=2 THEN
    wData=$00CC  
    GoSub Send
    wData=$1AAA
    GoSub Send
    ENDIF
    IF Sz=3 THEN
    wData=$00CC  
    GoSub Send
    wData=$1FFF
    GoSub Send
    ENDIF
    
    com:                          
    FOR NC=1 TO 10	                                                           
    Hserin 4000,com_start,[echo]	     ' Get a echo from serial port
    IF ECHO=13 THEN 
    GOTO getinfo
    GOTO com 
    ENDIF
    IF NC=1  THEN  D(0)=ECHO               ' Store last 10 ASCII digits
    IF NC=2  THEN  D(1)=ECHO
    IF NC=3  THEN  D(2)=ECHO
    IF NC=4  THEN  D(3)=ECHO
    IF NC=5  THEN  D(4)=ECHO
    IF NC=6  THEN  D(5)=ECHO
    IF NC=7  THEN  D(6)=ECHO
    IF NC=8  THEN  D(7)=ECHO
    IF NC=9  THEN  D(8)=ECHO
    IF NC=10 THEN D(9)=ECHO
    hserout [echo]		                 ' Send echo out serial port           
    NEXT NC
    Goto com
    
    getinfo:                       
    GOSUB linefeed 
    IF D(0)=67 AND D(1)=76 AND D(2)=83 THEN                   ' CLS Clear screen
    GOSUB CLS
    GOSUB linefeed  
    hserout ["Clear screen"]    
    GOSUB linefeed 
    GOSUB linefeed                     
    CC=0: Lc=0 : L=0 : Cx=0 : Tx=0
    GOTO com 
    ENDIF 
    IF D(0)=67 THEN                                      ' C?????? set callsign
    CS[0]=D(1) : CS[1]=D(2) : CS[2]=D(3) : CS[3]=D(4) : CS[4]=D(5) : CS[5]=D(6) 
    GOSUB linefeed  
    hserout ["Set to ",CS(0),CS(1),CS(2),CS(3),CS(4),CS(5)]   
    GOSUB linefeed                      
    GOSUB linefeed  
    GOTO com 
    ENDIF 
    IF D(0)=68 AND D(1)=67 THEN                            ' DC display callsign
    GOSUB DC
    GOSUB linefeed  
    hserout ["callsign"]  
    GOSUB linefeed                       
    GOSUB linefeed  
    GOTO com 
    ENDIF               
    IF D(0)=84 AND D(1)=89 AND D(2)=80 AND D(3)=69 THEN        ' TYPE keyboard mode
    GOSUB linefeed 
    hserout ["Kybd mode"] 
    GOSUB linefeed                        
    GOSUB linefeed  
    GOTO TYPE
    ENDIF                                              ' Font size=1
    IF D(0)=72 AND D(1)=49 THEN 
    Sz=0
    GOSUB linefeed 
    hserout ["size=1"]  
    GOSUB linefeed 
    GOSUB linefeed 
    ENDIF
    IF D(0)=72 AND D(1)=50 THEN
    Sz=1
    GOSUB linefeed 
    hserout ["size=2"]                      ' Font size=2
    GOSUB linefeed 
    GOSUB linefeed 
    ENDIF  
    IF D(0)=72 AND D(1)=51 THEN
    Sz=2
    GOSUB linefeed  
    hserout ["size=3"]                      ' Font size=3
    GOSUB linefeed 
    GOSUB linefeed 
    ENDIF  
    IF D(0)=72 AND D(1)=52 THEN
    Sz=3
    GOSUB linefeed 
    hserout ["size=4"]                      ' Font size=4
    GOSUB linefeed 
    GOSUB linefeed 
    ENDIF 
    IF D(0)=82 AND D(1)=68 THEN                      ' 82 and 68 is RD to read callsign
    GOSUB linefeed   
    GOSUB Rdata 
    ENDIF
    IF D(0)=87 AND D(1)=68 THEN                      ' 82 and 68 WD write data 
    GOSUB linefeed 
    GOSUB Memstore                    
    hserout ["Writing data"]
    GOSUB linefeed 
    GOSUB linefeed  
    GOTO com
    ENDIF
    IF D(0)=84 AND D(1)=73 AND D(2)=77 AND D(3)=69 THEN  ' TIME display time on PC
    GOSUB linefeed 
    hserout ["Time is"]                        
    GOSUB linefeed 
    GOSUB linefeed 
    GOSUB PC_time
    GOTO com 
    ENDIF 
    IF D(0)=68 AND D(1)=65 AND D(2)=84 AND D(3)=69 THEN  ' DATE display time on PC
    GOSUB linefeed  
    hserout ["Date is"]                        
    GOSUB linefeed  
    GOSUB linefeed 
    GOSUB PC_date
    GOTO com 
    ENDIF
    IF D(0)=83 AND D(1)=84 THEN                      ' ST Set time format "hh:mm" enter to set
    T10=D(2) : T1=D(3)
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$04,[Co]
    T10=D(5) : T1=D(6)
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$03,[Co]
    GOSUB linefeed  
    hserout [D(2),D(3),":",D(5),D(6)] 
    GOSUB linefeed                        
    GOSUB linefeed 
    GOTO com  
    ENDIF 
    IF D(0)=83 AND D(1)=83 THEN                      ' SS Set seconds format "ss" enter to set
    GOSUB linefeed  
    hserout [D(2),D(3)," secs"] 
    GOSUB linefeed                        
    GOSUB linefeed 
    T10=D(2) : T1=D(3) 
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$02,[Co]
    GOTO com 
    ENDIF 
    IF D(0)=83 AND D(1)=68 THEN                      ' SD Set date format "dd/MM/YY" enter to set
    T10=D(2) : T1=D(3)
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$05,[Co]
    T10=D(5) : T1=D(6)
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$07,[Co]
    T10=D(8) : T1=D(9)
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$08,[Co]
    GOSUB linefeed  
    hserout [D(2),D(3),"/",D(5),D(6),"/",D(8),D(9)]  
    GOSUB linefeed                       
    GOSUB linefeed 
    GOTO com 
    ENDIF 
    IF D(0)=83 AND D(1)=87 THEN                     ' SW Set week day format "w" enter to set
    GOSUB linefeed  
    hserout [D(2)," day"] 
    GOSUB linefeed                        
    GOSUB linefeed  
    T10=0 : T1=D(2)
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$06,[Co]
    GOTO com 
    ENDIF 
    IF D(0)=68 AND D(1)=84 AND D(2)<>77 AND D(3)<>80 THEN  ' DT Display time via video
    J=0 
    GOSUB linefeed  
    hserout ["time"]   
    GOSUB linefeed                      
    GOSUB linefeed  
    GOSUB v_time
    ENDIF
    IF D(0)=68 AND D(1)=68 THEN                        ' DD Display date via video
    Cx=1
    GOSUB linefeed 
    hserout ["date"] 
    GOSUB linefeed                        
    GOSUB linefeed  
    GOSUB v_date
    ENDIF
    IF D(0)=68 AND D(1)=84 AND D(2)=77 AND D(3)=80 THEN    ' DTMP display temperature via video
    Tx=1
    GOSUB linefeed 
    hserout ["Dis temp"] 
    GOSUB linefeed                        
    GOSUB linefeed 
    GOSUB temp
    ENDIF
    IF D(0)=84 AND D(1)=69 AND D(2)=77 AND D(3)=80 THEN    ' TEMP display temperature
    GOSUB linefeed 
    hserout ["Temp is"]                        
    GOSUB linefeed 
    GOSUB linefeed 
    GOSUB Tempcom
    GOTO com 
    ENDIF 
    IF D(0)=72 AND D(1)=69 AND D(2)=76 AND D(3)=80 THEN    ' HELP infomation
    GOSUB linefeed 
    hserout ["CLS clear disp"] 
    GOSUB linefeed 
    hserout ["DC display callsign"]
    GOSUB linefeed 
    hserout ["DTMP display temp"]
    GOSUB linefeed 
    hserout ["DT dis time"]
    GOSUB linefeed 
    hserout ["DD disp date"]
    GOSUB linefeed 
    hserout ["H1,H2,H3,H4 font sizes 1x up to 4x"]
    GOSUB linefeed 
    hserout ["TYPE keyboard text mode, video overlay"]
    GOSUB linefeed 
    hserout ["TIME time on PC"]
    GOSUB linefeed 
    hserout ["DATE date on PC"]
    GOSUB linefeed 
    hserout ["TEMP display temp on PC"]
    GOSUB linefeed 
    GOSUB linefeed 
    hserout ["Setup info"]
    GOSUB linefeed 
    hserout ["RD read data"]                        
    GOSUB linefeed 
    hserout ["WD write data"]
    GOSUB linefeed 
    hserout ["C?????? set callsign"]
    GOSUB linefeed 
    hserout ["SS set secs format 'ss'"]
    GOSUB linefeed 
    hserout ["ST set time format 'hh:mm'"]
    GOSUB linefeed 
    hserout ["SD set date format 'dd/MM/YY'"]
    GOSUB linefeed 
    hserout ["SW set week day format 'w'"]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com 
    ENDIF 
    GOTO com_start
    
    Rdata:
    GOSUB linefeed 
    hserout ["Font size=",DEC Sz+1]
    GOSUB linefeed 
    GOSUB Memread
    GOSUB linefeed 
    hserout ["Callsign=",CS(0),CS(1),CS(2),CS(3),CS(4),CS(5)]    ' Send message 
    GOSUB linefeed 
    GOSUB linefeed 
    GOSUB linefeed 
    rETURN
    
    Memstore:             ' Store Callsign
    FOR C=0 TO 5
    WRITE C,CS[C] 
    NEXT C
    RETURN 
    
    Memread:              ' Read Callsign
    FOR C=0 TO 5
    READ C,CS[C]  
    NEXT C
    RETURN 
    
    DCLS:                 ' Clear the screen set to ' '
    FOR C=0 TO 27
    D[C]=32 
    NEXT C
    RETURN
    
    com1:                          
    GOSUB DCLS
    FOR NC=1 TO 28	                                                           
    Hserin 4000,com1,[echo]	            ' Get a echo from serial port
    IF ECHO=13 THEN GOTO TYPE1
    IF ECHO=9 THEN GOSUB Tabspace
    IF ECHO=92 THEN 
    GOSUB CLS : CC=0: Lc=0 : L=0
    GOTO com1 : ENDIF
    IF ECHO=8 THEN 
    GOSUB Backspace : ENDIF
    IF ECHO=27  THEN 
    GOSUB linefeed 
    hserout ["Exit"]  
    GOSUB linefeed 
    GOSUB linefeed  
    GOTO com : ENDIF
    IF NC=1  THEN D(0)=ECHO               ' Store last 28 ASCII digits
    IF NC=2  THEN D(1)=ECHO
    IF NC=3  THEN D(2)=ECHO
    IF NC=4  THEN D(3)=ECHO
    IF NC=5  THEN D(4)=ECHO
    IF NC=6  THEN D(5)=ECHO                 
    IF NC=7  THEN D(6)=ECHO
    IF NC=8  THEN D(7)=ECHO
    IF NC=9  THEN D(8)=ECHO
    IF NC=10 THEN D(9)=ECHO
    IF NC=11 THEN D(10)=ECHO                
    IF NC=12 THEN D(11)=ECHO
    IF NC=13 THEN D(12)=ECHO
    IF NC=14 THEN D(13)=ECHO
    IF NC=15 THEN D(14)=ECHO
    IF NC=16 THEN D(15)=ECHO                 
    IF NC=17 THEN D(16)=ECHO
    IF NC=18 THEN D(17)=ECHO
    IF NC=19 THEN D(18)=ECHO
    IF NC=20 THEN D(19)=ECHO
    IF NC=21 THEN D(20)=ECHO                
    IF NC=22 THEN D(21)=ECHO
    IF NC=23 THEN D(22)=ECHO
    IF NC=24 THEN D(23)=ECHO
    IF NC=25 THEN D(24)=ECHO
    IF NC=26 THEN D(25)=ECHO                 
    IF NC=27 THEN D(26)=ECHO
    IF NC=28 THEN D(27)=ECHO
    hserout [echo]		                 ' Send echo out serial port           
    NEXT NC
    Goto com1
    
    Tabspace:
    TAB=TAB+7 
    FOR C=1 TO 7
    Echo=32
    hserout [echo]
    NEXT C
    RETURN
     
    Backspace:
    NC=NC-1
    IF NC<=1 THEN NC=1
    LOOKUP2 Nc,[0,D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9),D(10),D(11),D(12),D(13),D(14),D(15),D(16),D(17),D(18),D(19),D(20),D(21),D(22),D(23),D(24),D(25),D(26),D(27)],Co
    Co=Echo
    hserout [echo]
    Hserin 2000,com_start,[echo]	     ' Get a echo from serial port
    IF ECHO=8 THEN GOTO Backspace
    RETURN
    
    DC:                ' Display callsign
    GOSUB DCLS
    GOSUB Memread
    FOR C=0 TO 5
    AS=CS[C]
    GOSUB Convert
    D[C]=AS
    NEXT C
    X=1
    GOSUB Display
    X=0
    RETURN
    
    TYPE:                      ' Conversion for the video overlay
    GOSUB linefeed 
    GOTO com1
    TYPE1:
    GOSUB linefeed 
    AS=D(0)
    GOSUB Convert
    D(0)=AS
    AS=D(1)
    GOSUB Convert
    D(1)=AS
    AS=D(2)
    GOSUB Convert
    D(2)=AS
    AS=D(3)
    GOSUB Convert
    D(3)=AS
    AS=D(4)
    GOSUB Convert
    D(4)=AS
    AS=D(5)
    GOSUB Convert
    D(5)=AS
    AS=D(6)
    GOSUB Convert
    D(6)=AS
    AS=D(7)
    GOSUB Convert
    D(7)=AS
    AS=D(8)
    GOSUB Convert
    D(8)=AS
    AS=D(9)
    GOSUB Convert
    D(9)=AS
    AS=D(10)
    GOSUB Convert
    D(10)=AS
    AS=D(11)
    GOSUB Convert
    D(11)=AS
    AS=D(12)
    GOSUB Convert
    D(12)=AS
    AS=D(13)
    GOSUB Convert
    D(13)=AS
    AS=D(14)
    GOSUB Convert
    D(14)=AS
    AS=D(15)
    GOSUB Convert
    D(15)=AS
    AS=D(16)
    GOSUB Convert
    D(16)=AS
    AS=D(17)
    GOSUB Convert
    D(17)=AS
    AS=D(18)
    GOSUB Convert
    D(18)=AS
    AS=D(19)
    GOSUB Convert
    D(19)=AS
    AS=D(20)
    GOSUB Convert
    D(20)=AS
    AS=D(21)
    GOSUB Convert
    D(21)=AS
    AS=D(22)
    GOSUB Convert
    D(22)=AS
    AS=D(23)
    GOSUB Convert
    D(23)=AS
    AS=D(24)
    GOSUB Convert
    D(24)=AS
    AS=D(25)
    GOSUB Convert
    D(25)=AS
    AS=D(26)
    GOSUB Convert
    D(26)=AS
    AS=D(27)
    GOSUB Convert
    D(27)=AS
    GOSUB Display
    GOTO com1
    
    Convert:                           ' Convert from ACSII to TROM data of the STV5730A
    IF AS>=48 AND AS<=57  THEN 
    AS=AS-48
    RETURN
    ENDIF
    IF AS>=65 AND AS<=90  THEN 
    AS=AS-53
    RETURN
    ENDIF
    IF AS>=97 AND AS<=122 THEN 
    AS=AS-55
    RETURN
    ENDIF 
    IF AS>=46 AND AS<=47  THEN 
    AS=AS-7
    RETURN
    ENDIF
    IF AS=45 THEN 
    AS=$A
    RETURN
    ENDIF
    IF AS=32 THEN 
    AS=$B
    RETURN
    ENDIF
    IF AS=34 THEN 
    AS=$6F
    RETURN
    ENDIF
    IF AS=58 THEN 
    AS=$26
    RETURN
    ENDIF
    IF AS=39 THEN 
    AS=$29
    RETURN
    ENDIF
    IF AS=42 THEN 
    AS=$5F
    RETURN
    ENDIF
    IF AS=43 THEN 
    AS=$5E
    RETURN
    ENDIF
    IF AS=63 THEN 
    AS=$70
    RETURN
    ENDIF
    IF AS=60 THEN 
    AS=$7B
    RETURN
    ENDIF
    IF AS=62 THEN 
    AS=$7A
    RETURN
    ENDIF
    IF AS=94 THEN 
    AS=$7C
    RETURN
    ENDIF
    IF AS=124 THEN 
    AS=$7D
    RETURN
    ENDIF
    IF AS=35 THEN 
    AS=$6E
    RETURN
    ENDIF
    IF AS=36 THEN 
    AS=$71
    RETURN
    ENDIF
    IF AS=37 THEN 
    AS=$79
    RETURN
    ENDIF
    IF AS=64 THEN 
    AS=$45
    RETURN
    ENDIF
    IF AS=61 THEN
    AS=$78
    ELSE 
    AS=$B
    ENDIF  
    RETURN
    
    Display:                              ' Font size 1 to 4
    IF Sz=0 THEN GOSUB Size_1
    IF Sz=1 THEN GOSUB Size_2
    IF Sz=2 THEN GOSUB Size_3
    IF Sz=3 THEN GOSUB Size_4
    RETURN
    
    Size_1:                               
    wData=L+tab
    gosub Send
    IF X=0 THEN 
    J=27
    ELSE
    J=5
    ENDIF
    FOR C=0 TO J
    LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9),D(10),D(11),D(12),D(13),D(14),D(15),D(16),D(17),D(18),D(19),D(20),D(21),D(22),D(23),D(24),D(25),D(26),D(27)],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$B00 THEN L=0 
    TAB=0
    RETURN
    
    Size_2:
    wData=L+tab
    gosub Send
    FOR C=0 TO 13
    LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9),D(10),D(11),D(12),D(13)],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$600 THEN L=0 
    TAB=0
    RETURN
    
    Size_3:
    wData=L+tab
    gosub Send
    FOR C=0 TO 9
    LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9)],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$400 THEN L=0 
    TAB=0
    RETURN
    
    Size_4:
    wData=L+tab
    gosub Send
    FOR C=0 TO 6
    LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6)],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$300 THEN L=0 
    TAB=0
    RETURN
    
    linefeed:
    hserout [13,10]
    return

    Thanks, Ed

  2. #2
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    According to my limited google, the STV5730 went end of life in 2005.

    I did come across this site which might offer you some info. It contains hex for a PIC (16F873) and schematics http://www.pi6tv.net/picosd/picosd_uk.html


    Also that he uses the same Xtal (17,734475 MHz) as a reference for both chips. The PIC code uses a 20Mhz xtal, and has a different pin out to that specified in the 16F873 code.

    I think you need to link to the source of the PBP code and presumably the associated schematic etc
    Last edited by Scampy; - 20th May 2017 at 21:29.

  3. #3
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    Yes Scampy the STV5730 was discontinued for a short time and now it is easy to buy. The best part about the STV5730 is you can display text in color!
    Attached Images Attached Images  

  4. #4
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    Ed,

    What PIC do you want to use? What information do you want to overlay? Will you need to edit the text displayed or will it be static? Do you have the ability to design and build the circuit as external components are required?

    I'm not that experienced with PBP, but I'm sure that the above code could be hacked to get the basics working once we know a bit more about the project you wish to develop

  5. #5
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    Came across this code which uses a 16F628A @4Mhz, might be a bit simpler to follow as it seems to overlay a set message rather than have the option to type something on a PC which is then sent to the PIC and overlaid on the TV

    Code:
    'OSDCSX.bas version 2.0
    'Incruser with STV5730A and PIC 16F628 - 4 MHz
    'Source for PICBasic PRO 
    'Risto Kõiva 2001, F1FCO & F6CSX, March 2003
    'Turns on F1UBZ insert (part RS232 / MAX232 useless) or demo board STV5730 
    'Page mode, color bars
    Cyclic change of background color
    23cm or 70cm band display according to pin 18 status (RA1)
    
    
    '** HARDWARE DEFINITION **
    
    	CMCON = 7 'put the 16F628 in digital mode on PORT A
    
    
    	Clk VAR PORTB.5
    	Sda VAR PORTB.6
    	Csn VAR PORTB.4
    	Mute VAR PORTB.7 '0 if sync valid, 1 if no sync
    	VAR mode PORTB.3 'pin # 9, 0 = Page mode, 1 = Mixed mode
    	On_off VAR PORTA.2 'Stop the incruser: pin # 1, 0 = off, 1 = on	
    	Band VAR PORTA.1 'incrustation 23 cm if 0 or 70 cm if 1
    	
    INPUT Mode
    INPUT Mute
    INPUT On_off
    INPUT Band
    
    OUTPUT Clk
    OUTPUT Sda
    OUTPUT Csn
    
    ** DEFINITION OF VARIABLES **
    	
    	ICount VAR BYTE
    	Bit_Counter VAR BYTE
    	WData VAR WORD
    	C VAR WORD
    	B1 VAR BYTE
    	B2 VAR BIT
    	B3 VAR BIT
    	B4 VAR BIT
    	
    	W1 VAR BYTE
    	W2 VAR BYTE
    	
    	'** START OF PROGRAM **
    	
    	GOSUB Init 'initialization
    	GOSUB Mode_mixte 'Mixed mode by default
    	GOSUB affiche_mixte 
    	b1 = 1
    	b2 = 1
    	b3 = 0	
    	
    Loop:	
    
    	B1 = On_off
    	IF b1 = 0 THEN Incrust_off 'monitors the On_off button
    	B4 = Band
    	IF b4 = 0 THEN
    		W1 = $ 02
    		W2 = $ 03
    		ELSE
    		W1 = $ 07
    		W2 = $ 00
    	ENDIF
    		
    	B3 = MODE 'reads MODE	
    	IF b3 = b2 THEN Jump 'does not change anything
    		
    	IF b3 = 1 THEN 'If MODE = 1: Mixed Mode, Picture Overlay
    		
    		GOSUB Mode_mixte
    		GOSUB affiche_mixte 		
    		B2 = b3
    		ELSE 
    		GOSUB Mode_page 'Mode Page: Mire		
    		FOR c = 0 TO 6
    		WData = $ 00CD: GOSUB Send '(tip at address 13)
    		WData = $ 1000 + ($ 201 * c): GOSUB Send 'background color change 
    		GOSUB show_page
    		PAUSE 2000
    		NEXT c
    		B3 = Mode 'reads mode
    		B2 = ~ b3 'b2 is not equal to b3, we do not jump and we start again
    	ENDIF 
    		
    	PAUSE 500
    	GOTO Buckle		
    
    Jumped up:
    	PAUSE 200
    	GOTO Buckle
    
    
    	END
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    Incrust_off: 'No overlay. We go into mixed mode and we delete the screen
    
    		GOSUB Mode_mixte
    		PAUSE 100
    		b1 = 1
    		B3 = Mode 'reads mode
    		B2 = ~ b3 'b2 is not equal to b3, we do not jump
    		GOTO Buckle
    			
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------	
    Delete_Screen: 'No Overlay
    	
        WData = 0: GOSUB Send 'tip top left of screen (0,0)
        c = 1
        FOR c = 1 TO 308 'on clears the screen with spaces (0B)
    	WData = $ 1700 + $ 0B: GOSUB Send '$ 1700: background disabled, white character not blinking
        NEXT c
        RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------    
    Display_mixte: 'display in overlay mode
      
        WData = 0: GOSUB Send 'do not omit this line: position 0,0
        WData = $ 1780 + $ 6E: GOSUB Send 'flashing parable
        WData = $ 170B: GOSUB Send 'space
        WData = $ 1700 + $ 11: GOSUB Send 'F
        WData = $ 1700 + $ 06: GOSUB Send '6	
        WData = $ 1700 + $ 0E: GOSUB Send 'C	
        WData = $ 1700 + $ 1E: GOSUB Send 'S
        WData = $ 1700 + $ 23: GOSUB Send 'X
    
         WData = $ 170B: GOSUB Send 'space
         WData = $ 170B: GOSUB Send 'space
         WData = $ 170B: GOSUB Send 'space
              
        WData = $ 1700 + $ 18: GOSUB Send 'M   
        WData = $ 1700 + $ 0C: GOSUB Send 'A
        WData = $ 1700 + $ 1D: GOSUB Send 'R
        WData = $ 1700 + $ 1E: GOSUB Send 'S
        WData = $ 1700 + $ 10: GOSUB Send 'E 
        WData = $ 1700 + $ 14: GOSUB Send 'I
        WData = $ 1700 + $ 17: GOSUB Send 'L	
        WData = $ 1700 + $ 17: GOSUB Send 'L
        WData = $ 1700 + $ 10: GOSUB Send 'E	
        
         WData = $ 170B: GOSUB Send 'space
         WData = $ 170B: GOSUB Send 'space
         WData = $ 170B: GOSUB Send 'space    
        
        WData = $ 1700 + $ 15: GOSUB Send 'J   
        WData = $ 1700 + $ 19: GOSUB Send 'N
        WData = $ 1700 + $ 02: GOSUB Send '2
        WData = $ 1700 + $ 03: GOSUB Send '3
        WData = $ 1700 + $ 1D: GOSUB Send 'R 
        WData = $ 1700 + $ 13: GOSUB Send 'H
      		
    	PAUSE 1000	 
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    Display_page: 'display in page mode
    
    'First line in Max Zoom
      
        WData = 0: GOSUB Send 'do not omit this line: position 0,0 Line 0
        WData = $ 1F0B: GOSUB Send 'space
        WData = $ 1F00 + $ 11: GOSUB Send 'F with blue background
        WData = $ 1F00 + $ 06: GOSUB Send '6	
        WData = $ 1F00 + $ 0E: GOSUB Send 'C	
        WData = $ 1F00 + $ 1E: GOSUB Send 's
        WData = $ 1F00 + $ 23: GOSUB Send 'X
    
    
        WData = $ 100: GOSUB Send 'line 1
        WData = $ 170B: GOSUB Send 'space
        WData = $ 170B: GOSUB Send 'space
        WData = $ 1700 + $ 1A: GOSUB Send 'O with black background
        WData = $ 1700 + $ 39: GOSUB Send 'p
        WData = $ 1700 + $ 26: GOSUB Send ':
        WData = $ 1700 + $ 15: GOSUB Send 'J
        WData = $ 1700 + $ 1A: GOSUB Send 'O
        WData = $ 1700 + $ 10: GOSUB Send 'E
        WData = $ 1700 + $ 17: GOSUB Send 'L
         WData = $ 170B: GOSUB Send 'space
        WData = $ 170B: GOSUB Send 'space
        WData = $ 170B: GOSUB Send 'space
        WData = $ 170B: GOSUB Send 'space
         
        WData = $ 1700 + $ 1C: GOSUB Send 'Q
        WData = $ 1700 + $ 1F: GOSUB Send 'T
        WData = $ 1700 + $ 13: GOSUB Send 'H   
        WData = $ 1700 + $ 26: GOSUB Send ':    
        WData = $ 1700 + $ 18: GOSUB Send 'M   
        WData = $ 1700 + $ 0C: GOSUB Send 'A
        WData = $ 1700 + $ 1D: GOSUB Send 'R
        WData = $ 1700 + $ 1E: GOSUB Send 'S
        WData = $ 1700 + $ 10: GOSUB Send 'E 
        WData = $ 1700 + $ 14: GOSUB Send 'I
        WData = $ 1700 + $ 17: GOSUB Send 'L	
        WData = $ 1700 + $ 17: GOSUB Send 'L
        WData = $ 1700 + $ 10: GOSUB Send 'E
     
        WData = $ 200: GOSUB Send 'line 2 
        WData = $ 1700 + $ 1E: GOSUB Send 'S
        WData = $ 1700 + $ 1A: GOSUB Send 'O 
        WData = $ 1700 + $ 19: GOSUB Send 'N    
        WData = $ 1700 + $ 26: GOSUB Send ': 
        WData = $ 1700 + $ 01: GOSUB Send '1
        WData = $ 1700 + $ 04: GOSUB Send '4    
        WData = $ 1700 + $ 05: GOSUB Send '5
        WData = $ 1700 + $ 27: GOSUB Send '. 
        WData = $ 1700 + $ 02: GOSUB Send '2
        WData = $ 1700 + $ 02: GOSUB Send '2    
        WData = $ 1700 + $ 05: GOSUB Send '5
        WData = $ 1700 + $ 18: GOSUB Send 'M 
        WData = $ 1700 + $ 13: GOSUB Send 'H    
        WData = $ 1700 + $ 43: GOSUB Send 'z
        WData = $ 170B: GOSUB Send 'space    
        WData = $ 1700 + $ 38: GOSUB Send 'o
        WData = $ 1700 + $ 3E: GOSUB Send 'u      
        WData = $ 170B: GOSUB Send 'space
        WData = $ 1700 + $ 01: GOSUB Send '1
        WData = $ 1700 + $ 04: GOSUB Send '4    
        WData = $ 1700 + $ 05: GOSUB Send '5    
        WData = $ 1700 + $ 27: GOSUB Send '. 
        WData = $ 1700 + $ 04: GOSUB Send '4   
        WData = $ 1700 + $ 00: GOSUB Send '0     
        WData = $ 1700 + $ 00: GOSUB Send '0
        WData = $ 1700 + $ 18: GOSUB Send 'M 
        WData = $ 1700 + $ 13: GOSUB Send 'H    
        WData = $ 1700 + $ 43: GOSUB Send 'z    
           
                                             
     'Color bars, 4 lines  
       
     FOR iCount = $ 0 TO $ 3
        WData = $ 300 + $ 100 * iCount: GOSUB Send 'to the beginning of line 3
        
        	
        WData = $ 170B: GOSUB Send 'space
        WData = $ 170B: GOSUB Send 'space
        
        WData = $ 1877: GOSUB Send 'black
        WData = $ 1877: GOSUB Send
        WData = $ 1877: GOSUB Send
    
        WData = $ 1977: GOSUB Send
        WData = $ 1977: GOSUB Send
        WData = $ 1977: GOSUB Send
    
        WData = $ 1A77: GOSUB Send
        WData = $ 1A77: GOSUB Send
        WData = $ 1A77: GOSUB Send
    
        WData = $ 1B77: GOSUB Send
        WData = $ 1B77: GOSUB Send
        WData = $ 1B77: GOSUB Send
    
        WData = $ 1C77: GOSUB Send
        WData = $ 1C77: GOSUB Send
        WData = $ 1C77: GOSUB Send
    
        WData = $ 1D77: GOSUB Send
        WData = $ 1D77: GOSUB Send
        WData = $ 1D77: GOSUB Send    
    
        WData = $ 1E77: GOSUB Send
        WData = $ 1E77: GOSUB Send
        WData = $ 1E77: GOSUB Send    
    
        WData = $ 1F77: GOSUB Send
        WData = $ 1F77: GOSUB Send
        WData = $ 1F77: GOSUB Send 'white
         NEXT iCount  
    
    	
    	WData = $ 700: GOSUB Send
    	FOR iCount = $ 1 TO $ 8
    	 WData = $ 170B: GOSUB Send 'space
    	 NEXT iCount 
    	WData = $ 1700 + $ 5F: GOSUB Send '*
    	WData = $ 1700 + $ 5F: GOSUB Send '*
    	WData = $ 1700 + $ 5F: GOSUB Send '*
    	WData = $ 170B: GOSUB Send 'space
    	WData = $ 1780 + W1: GOSUB Send '2 or 7
       	WData = $ 1780 + W2: GOSUB Send '3 or 0
       	WData = $ 1780 + $ 2C: GOSUB Send 'c
       	WData = $ 1780 + $ 36: GOSUB Send 'm
       	WData = $ 170B: GOSUB Send 'space
       	WData = $ 1700 + $ 5F: GOSUB Send '*
    	WData = $ 1700 + $ 5F: GOSUB Send '*
    	WData = $ 1700 + $ 5F: GOSUB Send '*
       	
       
       PAUSE 1000	
    	
    	RETURN
    
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    WasteTime: 'timer 2 clock cycles 
    	ASM
    	  nop
    	  nop
    	ENDASM
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    StartCommunication: Start of transmission Fig 2 page 12 manual STV5730A
    	HIGH Clk: GOSUB WasteTime 'Clock to 1
    	LOW Csn: GOSUB WasteTime 'Chip select to 0
    	LOW Clk: GOSUB WasteTime 'Clock at 0
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    StopCommunication: 'end of transmission 
    	HIGH Clk: GOSUB WasteTime 'Clock to 1
    	HIGH Csn: GOSUB WasteTime 'Chip select to 1
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    SendOne: Send a bit 0
    	HIGH Sda: GOSUB WasteTime
    	LOW Clk: GOSUB WasteTime
    	HIGH Clk: GOSUB WasteTime
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    SendZero: sending a bit 1
    	LOW Sda: GOSUB WasteTime
    	LOW Clk: GOSUB WasteTime
    	HIGH Clk: GOSUB WasteTime
    	HIGH Sda: GOSUB WasteTime
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    OutByte: 'send a 16 bit word
    	FOR Bit_Counter = 1 TO 16
    	 IF wData.15 = 1 THEN 'MSB first
    	  GOSUB SendOne
    	 ELSE
    	  GOSUB SendZero
    	 ENDIF
    	 WData = wData << 1
    	NEXT Bit_Counter
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    Send:
    	GOSUB StartCommunication
    	GOSUB OutByte
    	GOSUB StopCommunication
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    Init: '** INITIALIZATION (see page 12 of the DATA SHEET STV5730)
    
    	HIGH Clk: HIGH Sda: HIGH Csn
    	WData = $ 3000: GOSUB Send 'Init STV5730
    	WData = $ 3000: GOSUB Send
    	WData = $ 00DB: GOSUB Send
    	WData = $ 1000: GOSUB Send
    	RETURN
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------	
    Mode_page: 'PAGE MODE INITIALIZATION
    
    	WData = $ 00CC: GOSUB Send 'Registry initialization (tip at address 12)
    	WData = $ 150F: GOSUB Send 'Zoom 
    	WData = $ 1201: GOSUB Send 'Color 
    	WData = $ 1FC5: GOSUB Send 'Control
    	WData = $ 15A1: GOSUB Send 'Position (horizontal 33, Vertical 22)
    	WData = $ 193E: GOSUB Send 'Fashion 
    
    	WData = $ 00C0: GOSUB Send 'Set row attributes (tip to first line address)
    	 WData = $ 10C4: GOSUB Send '(vertical position = 4, characters with border, characters displayed, horizontal position = 0)
    	  WData = $ 10C4: GOSUB Send '(vertical position = 4, characters with border, characters displayed, horizontal position = 0)
    	 WData = $ 10C4: GOSUB Send '(vertical position = 4, characters with border, characters displayed, horizontal position = 0)
    	WData = $ 10C8: GOSUB Send
    	FOR iCount = 0 TO 2	
    	 WData = $ 10C0: GOSUB Send '(vertical position = 0, characters with border, characters displayed, horizontal position = 0)
    	NEXT iCount 'Same for the next 10 lines
    	 WData = $ 10C8
    	 
    	 GOSUB Clear_screen
    	RETURN
    
    '------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------
    Mode_mixte: 'INITIALIZATION IN JOINT MODE
    
    	WData = $ 00CC: GOSUB Send 'Registry initialization (tip at address 12)
    	WData = $ 1000: GOSUB Send 'Zoom (1pixel / dot - 1 pixel / line)
    	WData = $ 1204: GOSUB Send 'Color (red background, line, character background)
    	WData = $ 1FD4: GOSUB Send 'Control (mixed mode, character background controlled by BE, display on, color character by character attribute
    				0.5s flashing, duty cycle 0.5, STV sync, PAL, external luminance level, normal full page mode 
    	WData = $ 15A1: GOSUB Send 'Position (horizontal 33, Vertical 22)
    	WData = $ 183E: GOSUB Send 'Mode (disconnected BAR, synch pulse detection, internal mute, 32-line mute time, re-inserted sync, 6dB video gain
    				Color coder in use, video out2 = video in, video out2 low impedance, normal mode, no delay compensation,
    				'M sync with vertical sync
    
    	WData = $ 00C0: GOSUB Send 'Set row attributes (tip to first line address)
    	FOR iCount = 0 TO 10	
    	 WData = $ 10C4: GOSUB Send '(vertical position = 4, characters with border, characters displayed, horizontal position = 0)
    	NEXT iCount 'Same for the following lines
    	GOSUB Clear_screen
    	RETURN
    The code appears to be set to PAL timing so that would need to be adjusted for NTSC, plus, given the age of the chip I'm betting the output will be in 4:3 ratio PAL standard - so on modern TV's the overlay will have two bars either side of the screen.

  6. #6
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    Thank you!!!

  7. #7
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    Again I am looking at code that seems to be not written for PBP and/or is not complete. If you try and compile the code there are references to missing subroutines such as a subroutine called "buckle" as well as others. You would have to try and compile the code to see all the errors. The compiler seems to not be happy with any of the "$" in the Wdata statements! There is just so much I really do not understand. Here is what I have so far which is very little. I think if I can understand how to send commands to the STV5730 I could maybe make some serious progress? Just as an FYI using a crystal of 17.734475 MHz is for the PAL television standard. 14.318 MHz is for the American NTSC standard What we call "Never Twice the Same Color'! Best, Ed P.S. still have not mastered posting images.
    '************************************************* ***************
    '* Name : Data-Display.BAS *
    '* Author : Ed Cannady *
    '* Notice : Copyright (c) 2017 *
    '* : All Rights Reserved *
    '* Date : 6/3/2017 *
    '* Version : 1.0 *
    '* Notes : For use with an STV5730 and 18F2520 *
    '* : *
    '************************************************* ***************


    Define osc 20 'SET THE OSCILLATOR SPEED

    cmcon=7 'MAKE EVERYTHING DIGITAL

    DA VAR PORTC.4 'DATA OUT
    CL VAR PORTC.5 'CLOCK
    EN VAR PORTC.6 'CHIP ENABLE

    W VAR WORD



    INIT:
    HIGH CL : HIGH DA : HIGH EN 'RESET EVERYTHING
    PAUSE 250 'WAIT FOR THE RESET TO HAPPEN
    LOW EN ' ENABLE THE STV5730
    W=02 'SET THE BAUD RATE TO 9600
    ?
    ?
    ?
    HIGH CL : HIGH DA : HIGH EN ' prepare for next command
    Attached Images Attached Images    

  8. #8
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    It’s been translated from French where Boucle (Buckle) means Loop.

    http://f6csx.free.fr/ATV/STV5730/OSDCSX28.bas

  9. #9
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Is anyone willing to work with me to rewrite some code?

    Thanks Art!
    Turns out translating from French to English created several problems. Every Wdata statement contains a $xxxx. The translator changed this to $ xxxx, placing a space between the $ and the number! There were other translation errors and I am working to correct them.

    Best, Ed

Similar Threads

  1. Code doesn't work on 16F648A
    By Mr_Joe in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st September 2018, 23:09
  2. Replies: 6
    Last Post: - 6th April 2010, 20:27
  3. pls help me verify my code not work, why???
    By chai98a in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th January 2010, 10:19
  4. Why doesn't this servo code work?
    By artswan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th December 2009, 23:18
  5. Why doesn't my code for 18f452 work on 18f252?
    By senojlr in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2005, 03:42

Members who have read this thread : 1

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