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


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    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  

  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?

    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

  3. #3
    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.

  4. #4
    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!!!

  5. #5
    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    

  6. #6
    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

  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?

    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 : 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