A little HELP!!


Closed Thread
Results 1 to 40 of 77

Thread: A little HELP!!

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    News

    I have NTSC display full colour and in the correct position. Problem was low voltage on my STV board, when that was fixed it worked straight away.

    Code attached
    Program your 628a with the hex code, if it works on your 628A then you have a compiler prob or something, if it does not work you may have a naff 628a.

    Also I compile with Picbasic Pro Ver 2.60C - I think you compile using MPLAB, not sure of your PB version, try compiling the 628a code with the PBP compiler.

    heartbeat led remarked out

    cmcon added in, but not needed as you are not using port A

    TRIS B changed to reflect your ports use.


    Code:
    '****************************************************************
    '*  Name    : STV-SYNCHS RELEASE                          *
    '*  Author  : BOB LEGGETT                                       *
    '*  Notice  : Copyright (c) 2009                                *
    '*          : All Rights Reserved                               *
    '*  Date    : around 2009 or so rehashed now '17         *
    '*  Version : 1.0                                               *
    '*  Notes   :   VIDEO IDENT                                *
    '*          :                                                   *
    '****************************************************************
    
    
    
    '   WORKS USES SYNC FOR SWITCHING BETWEEN MIXED AND FULL TEXT MODE
    '   GOING FROM VID IN TO TEXT AND BACK TO VID IN
    
    @ device PIC16f628a,HS_OSC,BOD_ON,MCLR_ON,PWRT_ON 
    
       
            
        define  OSC 20
        
         
    'TV CHIP CONNECTIONS
     
    
     
    '---------------------------------------------------------------
       '16f628a  ED definitions
     
     TVSDA     		VAR PORTB.4    '0     OUTPUT  pin 11 stv was b.1
     CS0     		VAR PORTB.6    '0     OUTPUT pin 13 stv was b.0
     TVSCL     		VAR PORTB.5    '0     OUTPUT  pin 12 stv was b.5
     SYNCH0         VAR PORTB.7    '1     'INPUT    to pin 7 stvchip was b.2
     'HEARTBEAT      VAR PORTB.6           'OUTPUT 0  led was b.6
    '--------------------------------------------------------------- 
    
    '16f628a 
          
    '	  TVSDA     		VAR PORTB.1    '0     OUTPUT  pin 11 stv
    ' 	CS0     		VAR PORTB.0 '0       OUTPUT pin 13 stv
    '	TVSCL     		VAR PORTB.5    '0    OUTPUT  pin 12 stv
    '   SYNCH0          VAR PORTB.2 '1       'INPUT    to pin 7 stvchip
    '   HEARTBEAT        VAR PORTB.6     'OUTPUT 0  led
    '---------------------------------------------------------------
    
        ZOOMREG         CON %0000000011001100       ' 12 ZOOM REGISTER
        COLREG          CON %0000000011001101       ' 13 COLOUR REGISTER
        CONREG          CON %0000000011001110       ' 14 CONTROL REGISTER
        POSREG          CON %0000000011001111       ' 15 POSITION REGISTER 
        MODEREG         CON %0000000011010000       ' 16 MODE REGISTER
    
        
          
    	ICOUNT  		VAR BYTE
    	BITCOUNTER 	VAR BYTE
    	WDATA   		VAR WORD
    	CHARCOUNTER	VAR BYTE '  
    	LINECOUNTER	VAR BYTE '
    
    
         STVCHAR VAR BYTE
        ASCCHAR VAR BYTE
        CHARS VAR BYTE
        CHARS2 VAR BYTE
        TEMP    VAR BYTE 
        TEMP1   VAR BYTE
         COUNTER VAR BYTE
         PULSES VAR BYTE
        CURRENTMODE0 VAR BYTE
    
    '----------------------------------------------------------------     
    '    TOPLEFT          CON 0
    '    TOPMIDDLE       CON 5
    '    TOPRIGHT        CON 10
    '    BOTLEFT         CON 2560    '10*256
    '    BOTMIDDLE       CON 2565 '(10*256)+ 5
    '    BOTRIGHT        CON 2570 '(10*256)+ 10
    '---------------------------------------------------------------- 
    
        DATA @0,"NTSC ",$FF,"NO SYNCHS RECEIVED",$FF   
    
    
    
    '---------------------------------------------------------------- 
    '628
    '  TRISB=%10011100
      TRISB = %10001111
      CMCON=7
    '----------------------------------------------------------------     
    
    
        PAUSE 500
        
    '    HIGH HEARTBEAT
        
        
    	GOSUB Init
    	
        PAUSE 500
    	GOSUB Init
        
        CURRENTMODE0=255         ' FORCES TRYSYNCHS TO SET MODE FIRST TIME
    
    	
    Demo:
    
    CHARCOUNTER = 0
    	LINECOUNTER = 0
    '    CURRENTMODE0 = 0     '0 = MIXED 1 = TEXT
        gosub CLS
        GOSUB TRYSYNCHS      '==================================
    
    
        TEMP = 0
      
         
    
    LOOPER:
        GOSUB HEADER   ' LINE 3 RIGHT HAND SIDE TEST.
        IF CURRENTMODE0=1 THEN
        GOSUB NOVIDEO   ' DISPLAYS NO VIDEO IF NO INCOMING SYNCHS
        ENDIF
    
        
        GOSUB TRYSYNCHS       '===========================
        
    
    '    PAUSE 500            'I/2 SECOND DELAY
    '    TOGGLE HEARTBEAT      ' LED
        GOTO LOOPER          'DO IT FOREVER
      
    
    DISPLAYCHAR:   
    
        WDATA = %0001011100000000 + STVCHAR
        GOSUB SEND 
         RETURN
    SETLINE:    
    	WDATA = LINECOUNTER*256 + CHARCOUNTER
        GOSUB Send              'position cursor   
        RETURN
    
    
    
    WasteTime:        ' WORKS WITH LESS NOPS
    
    
    
        pauseus 20    ' was 20 nops
    
    	RETURN
    
    StartCommunication:
    	TVSCL = 1 'HIGH TVSCL 
        GOSUB WasteTime
    
        CS0 = 0 'LOW CS0
    
        GOSUB WasteTime
    	TVSCL = 0 'LOW TVSCL
        GOSUB WasteTime
    	RETURN
    
    StopCommunication:
    	TVSCL = 1 'HIGH TVSCL
        GOSUB WasteTime
        CS0 = 1 'HIGH CS0
    
        GOSUB WasteTime
    	RETURN
    
    SendOne:
    	TVSDA = 1 'HIGH TVSDA
        GOSUB WasteTime
    	TVSCL = 0 'LOW  TVSCL
        GOSUB WasteTime
    	TVSCL = 1 'HIGH TVSCL
        GOSUB WasteTime
    	RETURN
    
    SendZero:
    	TVSDA = 0 'LOW TVSDA
        GOSUB WasteTime
    	TVSCL = 0 ' LOW TVSCL
        GOSUB WasteTime
    	TVSCL = 1 'HIGH TVSCL
        GOSUB WasteTime
    	TVSDA = 1 'HIGH TVSDA
        GOSUB WasteTime
    	RETURN
    
    OutByte:
    	FOR BITCOUNTER = 1 TO 16
    	 IF WDATA.15 = 1 THEN
    	  GOSUB SendOne
    	 ELSE
    	  GOSUB SendZero
    	 ENDIF
    	 WDATA = WDATA << 1
    	NEXT BITCOUNTER
    	RETURN
    
    Send:
    	GOSUB StartCommunication
    	GOSUB OutByte
    	GOSUB StopCommunication
    	RETURN
    
    '-------------------------------------------------------------  
    
    Init:     '    PAUSE 50 added - seems to improve reliability of init
    
    	TVSCL = 1 'HIGH TVSCL
        TVSDA = 1 'HIGH TVSDA
        CS0 = 1 'HIGH CS0
     
    	WDATA = $3000  '%110000 00000000
        GOSUB Send ' Init STV5730
        PAUSE 50
    	WDATA = $3000
        GOSUB Send
        PAUSE 50
    	WDATA = $00DB  '%00000000 11011011
        GOSUB Send
        PAUSE 50
    	WDATA = $1000  '%00010000 00000000
        GOSUB Send
        PAUSE 50
    '-------------------------------------------------------------  
    	WDATA = %0000000011001100
        GOSUB Send ' Init registers (point to register 12)
        PAUSE 50
    '-------------------------------------------------------------      
    	WDATA = %0001000000000000   'NORMAL
    '  WDATA = %0001000011110000   '4 PIXELS HORIZ AND VERT
        GOSUB Send ' Zoom    ADDRESS 12
        PAUSE 50
    '-------------------------------------------------------------      
    	WDATA = %0001001000000000
    
    '    	WDATA = %0001001000000100
             GOSUB Send ' Color    ADDRESS 13
             PAUSE 50
    '--------------------------------------------------------
                
     
         WDATA=  %0001101011010100    'BIT 8 = 0 FOR NTSC
    
     
         
                'CHANGE BIT 0 TO 1 FOR TEXT ONLY
        GOSUB Send ' Control    ADDRESS 14
    '-------------------------------------------------------------    
    	WDATA = %0001011111001111
        GOSUB Send ' Position    ADDRESS 15
    '------------------------------------------------------------- 
    
       
    	WDATA = %0001000000101110 '$183E BIT 11 CHANGED TO 0  M4 = 0
           GOSUB Send ' Mode    ADDRESS 16  %0001100000111110
    
    '------------------------------------------------------------- 
     
    	WDATA = $00C0   '%00000000 11000000
        GOSUB Send ' Set row attributes
         
    	FOR ICOUNT = 0 TO 10
    	 WDATA = $10C4 '%00010000 11000100
      	' WDATA =%0001000010000111
         GOSUB Send
    	NEXT ICOUNT
    	RETURN
     
    CLS: 
        'character=$0B       'SPACE
         TEMP1=0   ' LINECOUNTER
         TEMP =0    'CHARCOUNTER
    loop2:
        
    	WDATA = 0  ' LINECOUNTER*256 + CHARCOUNTER   ADDRESS
        GOSUB Send
        
    
    LOOP3:    '                :CHARACTERS        
    	WDATA = %0001011100001011  '     1011 0BH SPACECHARACTER
        GOSUB Send
    	TEMP = TEMP + 1
    	IF TEMP >= 28 THEN
        TEMP = 0
        TEMP1=TEMP1 + 1
    	ENDIF
    	IF TEMP1 >= 11 THEN SCREENBLANK
     	
        GOTO LOOP3
        
    SCREENBLANK:
    	RETURN
    
    GETSTVCHAR:                  'CONVERT ASCII TO STV
            STVCHAR =$7F   ' FORCES CLOCK PICTURE IF ERROR         
           LOOKDOWN ASCCHAR,["0123456789- ABCDEFGHIJKLMNOPQRSTUVWXYZ:./'abcdefghijklmnopqrstuvwxyz"],STVCHAR
                   RETURN 
    
    HEADER:
        LINECOUNTER=2       'SET START POSITION
        CHARCOUNTER=23      'SET CURSOR POSITION
        GOSUB SETLINE
        FOR CHARS2=0 TO 4
        READ CHARS2, ASCCHAR
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR
        NEXT
        RETURN
        
    NOVIDEO:
        LINECOUNTER=5       'SET START POSITION
        CHARCOUNTER=4       'SET CURSOR POSITION
        GOSUB SETLINE
        FOR CHARS2=6 TO 23      ' FROM EEPROM DATA
        READ CHARS2, ASCCHAR
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR
        NEXT
        RETURN
        
    TRYSYNCHS:
        
        PULSES=0
    
        COUNT SYNCH0,4,PULSES   '3MS SHOULD COUNT TO 2 OR 3
        IF PULSES > 0 THEN MIXED0
    FULL0:
    
        IF CURRENTMODE0=1 THEN RETURN
    
        WDATA=  %0000000011001110       'CONTROL REGISTER
        GOSUB SEND
        WDATA=  %0001101011010101   'NTSC
    
        
        
    '        WDATA=  %0001101011010101   'NTSC     BIT 8 = 0
                'CHANGE BIT 0 TO 1 FOR TEXT ONLY       OTIGINAL
                
     '     WDATA=  %0001101111010100
                'CHANGE BIT 0 TO 1 FOR TEXT ONLY        
        GOSUB SEND
    
    STAYHERE02:
      
        CURRENTMODE0=1
            GOSUB CLS
    GOBACK0:
        RETURN
    
    
    MIXED0:
        IF CURRENTMODE0=0 THEN RETURN
        WDATA=  %0000000011001110       'CONTROL REGISTER
        GOSUB SEND
        WDATA=  %0001100111010100    'ntsc
        
        
        
    '    WDATA=  %0001101011010100     'NTSC   BIT 8 = 0
        GOSUB SEND
    
    STAYHERE01:
    
        CURRENTMODE0=0
        GOSUB CLS
        RETURN
    HEX code for programmer compiled from above code

    Code:
    :100000006C28B400841780048413FA30A6000030F2
    :10001000A7005120A00AA50AA201A30100083405E7
    :10002000A600640000083405A7002606270534064C
    :100030000319A20A0319A30A2708A600A403031997
    :10004000A5030319A00B11282208672883161C1486
    :100050001A0883169B0A6728A301A200FF30A20793
    :10006000031CA307031C67280330A100E6303A20D5
    :100070002E28A101FC3EA000A109031C4528FF3049
    :100080000000A00703184028A0076400A10F3F2824
    :1000900008000310A00DA10DFF3E031849282008F9
    :1000A00067281030A800A101A001A70CA60C031C12
    :1000B0005F282208A00723080318230FA107A10C1B
    :1000C000A00CA50CA40CA80B5528240867288313A2
    :1000D000031383126400080083168F308600831296
    :1000E00007309F000130A300F4302D20DE200130C6
    :1000F000A300F4302D20DE20FF30C200BE01C40179
    :100100002C21CE21C701A12164004208013C031D1E
    :100110008A28B721CE21832800304607BA0017303D
    :100120000318013EBB00DA2008004408A600A7011E
    :10013000A2010130A3005120B8002508B9003E08F3
    :100140003807BA0039080318013EBB00DA2008005E
    :100150001430392008008616A8200613A82086121D
    :10016000A82008008616A8200617A8200800061652
    :10017000A8208612A8208616A82008000612A8200B
    :100180008612A8208616A8200616A820080001308E
    :10019000BD00640011303D020318D9286400BB1F64
    :1001A000D328B720D428BE200310BA0DBB0DBD0F35
    :1001B000C9280800AB20C720B22008008616061602
    :1001C0000617BA013030BB00DA2032302C20BA01D9
    :1001D0003030BB00DA2032302C20DB30BA00BB01DB
    :1001E000DA2032302C20BA011030BB00DA20323055
    :1001F0002C20CC30BA00BB01DA2032302C20BA01DE
    :100200001030BB00DA2032302C20BA011230BB0093
    :10021000DA2032302C20D430BA001A30BB00DA2079
    :10022000CF30BA001730BB00DA202E30BA001030C1
    :10023000BB00DA20C030BA00BB01DA20C301640081
    :100240000B30430203182B29C430BA001030BB0016
    :10025000DA20C30F1F290800C801C701BA01BB017A
    :10026000DA200B30BA001730BB00DA20C70A64006E
    :100270001C304702031C3E29C701C80A64000B302A
    :10028000480203184429312908007F30C600FF3096
    :10029000A200A20A2208433C031CA02955213C02CB
    :1002A000031D49292208C600A02901308A0022081E
    :1002B0005C3E03188A0A82003034313432343334DD
    :1002C0003434353436343734383439342D342034FA
    :1002D000413442344334443445344634473448345A
    :1002E00049344A344B344C344D344E344F3450340A
    :1002F00051345234533454345534563457345834BA
    :1003000059345A343A342E342F3427346134623419
    :1003100063346434653466346734683469346A3409
    :100320006B346C346D346E346F34703471347234B9
    :1003300073347434753476347734783479347A3469
    :1003400008000230C4001730BE009520C0016400D0
    :10035000053040020318B629400883169B0083121B
    :100360002620BC0045218C20C00FA729080005309D
    :10037000C4000430BE0095200630C0006400183070
    :1003800040020318CD29400883169B0083122620C3
    :10039000BC0045218C20C00FBE290800C5010430D7
    :1003A000A200A3010630840080300120C500640053
    :1003B000013045020318EF2964004208013C031D87
    :1003C000E2290800CE30BA00BB01DA20D530BA00ED
    :1003D0001A30BB00DA200130C2002C210800640072
    :1003E0004208003C031DF5290800CE30BA00BB01CD
    :1003F000DA20D430BA001930BB00DA20C2012C2137
    :020400000800F2
    :02400E00663F0B
    :104200004E005400530043002000FF004E004F00BA
    :104210002000530059004E00430048005300200086
    :104220005200450043004500490056004500440047
    :02423000FF008D
    :00000001FF
    Name:  NTSC 2.jpg
Views: 2411
Size:  228.5 KB

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


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Hi Aerostar!
    Thank you, Thank you, Thank you! I do not know how to save your hex code to a file? Second the statement "@ device PIC16f628a,HS_OSC,BOD_ON,MCLR_ON,PWRT_ON" does not allow me to compile the program, had to change it to a config. I am using Micro Code Studio Plus 5.0.0.5 PBPX 3.1.0.4 and MPLAB IDE V8.92. I did try 4 different 16F628A's and end up with the same results. I do have pin 4 of the 16F628A tied to +5v through a 4.7k resistor as i understand this to be the MCLR for the 16F628A. I believe our code is identical except for the config statement as I added the config to your code so it would compile. Not sure what else to change, maybe if you have time you can compile my version and see if it will work? I did order some more STV5730's which should be here any day now.

    Code:
    '****************************************************************
    '*  Name    : STV-SYNCHS RELEASE                          *
    '*  Author  : BOB LEGGETT                                       *
    '*  Notice  : Copyright (c) 2009                                *
    '*          : All Rights Reserved                               *
    '*  Date    : around 2009 or so rehashed now '17         *
    '*  Version : 1.0                                               *
    '*  Notes   :   VIDEO IDENT                                *
    '*          :                                                   *
    '****************************************************************
    
    
    
    '   WORKS USES SYNC FOR SWITCHING BETWEEN MIXED AND FULL TEXT MODE
    '   GOING FROM VID IN TO TEXT AND BACK TO VID IN
    
    ' @ device PIC16f628a,HS_OSC,BOD_ON,MCLR_ON,PWRT_ON 
    #CONFIG
        __config _HS_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG
       
            
        define  OSC 20
        
         
    'TV CHIP CONNECTIONS
     
    
     
    '---------------------------------------------------------------
       '16f628a  ED definitions
     
     TVSDA     		VAR PORTB.4    '0     OUTPUT  pin 11 stv was b.1
     CS0     		VAR PORTB.6    '0     OUTPUT pin 13 stv was b.0
     TVSCL     		VAR PORTB.5    '0     OUTPUT  pin 12 stv was b.5
     SYNCH0         VAR PORTB.7    '1     INPUT    to pin 7 stvchip was b.2
     'HEARTBEAT      VAR PORTB.6          OUTPUT 0  led was b.6
    '--------------------------------------------------------------- 
    
    '16f628a 
          
    '	TVSDA     		VAR PORTB.1    '0    OUTPUT  pin 11 stv
    ' 	CS0     		VAR PORTB.0    '0    OUTPUT pin 13 stv
    '	TVSCL     		VAR PORTB.5    '0    OUTPUT  pin 12 stv
    '   SYNCH0          VAR PORTB.2    '1    INPUT    to pin 7 stvchip
    '   HEARTBEAT       VAR PORTB.6    '     OUTPUT 0  led
    '---------------------------------------------------------------
    
        ZOOMREG         CON %0000000011001100       ' 12 ZOOM REGISTER
        COLREG          CON %0000000011001101       ' 13 COLOUR REGISTER
        CONREG          CON %0000000011001110       ' 14 CONTROL REGISTER
        POSREG          CON %0000000011001111       ' 15 POSITION REGISTER 
        MODEREG         CON %0000000011010000       ' 16 MODE REGISTER
    
        
          
    	ICOUNT  		VAR BYTE
    	BITCOUNTER 	VAR BYTE
    	WDATA   		VAR WORD
    	CHARCOUNTER	VAR BYTE '  
    	LINECOUNTER	VAR BYTE '
    
    
         STVCHAR VAR BYTE
        ASCCHAR VAR BYTE
        CHARS VAR BYTE
        CHARS2 VAR BYTE
        TEMP    VAR BYTE 
        TEMP1   VAR BYTE
         COUNTER VAR BYTE
         PULSES VAR BYTE
        CURRENTMODE0 VAR BYTE
    
    '----------------------------------------------------------------     
    '    TOPLEFT          CON 0
    '    TOPMIDDLE       CON 5
    '    TOPRIGHT        CON 10
    '    BOTLEFT         CON 2560    '10*256
    '    BOTMIDDLE       CON 2565 '(10*256)+ 5
    '    BOTRIGHT        CON 2570 '(10*256)+ 10
    '---------------------------------------------------------------- 
    
        DATA @0,"NTSC ",$FF,"NO SYNCHS RECEIVED",$FF   
    
    
    
    '---------------------------------------------------------------- 
    '628
    '  TRISB=%10011100
      TRISB = %10001111
      CMCON=7
    '----------------------------------------------------------------     
    
    
        PAUSE 500
        
    '    HIGH HEARTBEAT
        
        
    	GOSUB Init
    	
        PAUSE 500
    	GOSUB Init
        
        CURRENTMODE0=255         ' FORCES TRYSYNCHS TO SET MODE FIRST TIME
    
    	
    Demo:
    
    CHARCOUNTER = 0
    	LINECOUNTER = 0
    '    CURRENTMODE0 = 0     '0 = MIXED 1 = TEXT
        gosub CLS
        GOSUB TRYSYNCHS      '==================================
    
    
        TEMP = 0
      
         
    
    LOOPER:
        GOSUB HEADER   ' LINE 3 RIGHT HAND SIDE TEST.
        IF CURRENTMODE0=1 THEN
        GOSUB NOVIDEO   ' DISPLAYS NO VIDEO IF NO INCOMING SYNCHS
        ENDIF
    
        
        GOSUB TRYSYNCHS       '===========================
        
    
    '    PAUSE 500            'I/2 SECOND DELAY
    '    TOGGLE HEARTBEAT      ' LED
        GOTO LOOPER          'DO IT FOREVER
      
    
    DISPLAYCHAR:   
    
        WDATA = %0001011100000000 + STVCHAR
        GOSUB SEND 
         RETURN
    SETLINE:    
    	WDATA = LINECOUNTER*256 + CHARCOUNTER
        GOSUB Send              'position cursor   
        RETURN
    
    
    
    WasteTime:        ' WORKS WITH LESS NOPS
    
    
    
        pauseus 20    ' was 20 nops
    
    	RETURN
    
    StartCommunication:
    	TVSCL = 1 'HIGH TVSCL 
        GOSUB WasteTime
    
        CS0 = 0 'LOW CS0
    
        GOSUB WasteTime
    	TVSCL = 0 'LOW TVSCL
        GOSUB WasteTime
    	RETURN
    
    StopCommunication:
    	TVSCL = 1 'HIGH TVSCL
        GOSUB WasteTime
        CS0 = 1 'HIGH CS0
    
        GOSUB WasteTime
    	RETURN
    
    SendOne:
    	TVSDA = 1 'HIGH TVSDA
        GOSUB WasteTime
    	TVSCL = 0 'LOW  TVSCL
        GOSUB WasteTime
    	TVSCL = 1 'HIGH TVSCL
        GOSUB WasteTime
    	RETURN
    
    SendZero:
    	TVSDA = 0 'LOW TVSDA
        GOSUB WasteTime
    	TVSCL = 0 ' LOW TVSCL
        GOSUB WasteTime
    	TVSCL = 1 'HIGH TVSCL
        GOSUB WasteTime
    	TVSDA = 1 'HIGH TVSDA
        GOSUB WasteTime
    	RETURN
    
    OutByte:
    	FOR BITCOUNTER = 1 TO 16
    	 IF WDATA.15 = 1 THEN
    	  GOSUB SendOne
    	 ELSE
    	  GOSUB SendZero
    	 ENDIF
    	 WDATA = WDATA << 1
    	NEXT BITCOUNTER
    	RETURN
    
    Send:
    	GOSUB StartCommunication
    	GOSUB OutByte
    	GOSUB StopCommunication
    	RETURN
    
    '-------------------------------------------------------------  
    
    Init:     '    PAUSE 50 added - seems to improve reliability of init
    
    	TVSCL = 1 'HIGH TVSCL
        TVSDA = 1 'HIGH TVSDA
        CS0 = 1 'HIGH CS0
     
    	WDATA = $3000  '%110000 00000000
        GOSUB Send ' Init STV5730
        PAUSE 50
    	WDATA = $3000
        GOSUB Send
        PAUSE 50
    	WDATA = $00DB  '%00000000 11011011
        GOSUB Send
        PAUSE 50
    	WDATA = $1000  '%00010000 00000000
        GOSUB Send
        PAUSE 50
    '-------------------------------------------------------------  
    	WDATA = %0000000011001100
        GOSUB Send ' Init registers (point to register 12)
        PAUSE 50
    '-------------------------------------------------------------      
    	WDATA = %0001000000000000   'NORMAL
    '  WDATA = %0001000011110000   '4 PIXELS HORIZ AND VERT
        GOSUB Send ' Zoom    ADDRESS 12
        PAUSE 50
    '-------------------------------------------------------------      
    	WDATA = %0001001000000000
    
    '    	WDATA = %0001001000000100
             GOSUB Send ' Color    ADDRESS 13
             PAUSE 50
    '--------------------------------------------------------
                
     
         WDATA=  %0001101011010100    'BIT 8 = 0 FOR NTSC
    
     
         
                'CHANGE BIT 0 TO 1 FOR TEXT ONLY
        GOSUB Send ' Control    ADDRESS 14
    '-------------------------------------------------------------    
    	WDATA = %0001011111001111
        GOSUB Send ' Position    ADDRESS 15
    '------------------------------------------------------------- 
    
       
    	WDATA = %0001000000101110 '$183E BIT 11 CHANGED TO 0  M4 = 0
           GOSUB Send ' Mode    ADDRESS 16  %0001100000111110
    
    '------------------------------------------------------------- 
     
    	WDATA = $00C0   '%00000000 11000000
        GOSUB Send ' Set row attributes
         
    	FOR ICOUNT = 0 TO 10
    	 WDATA = $10C4 '%00010000 11000100
      	' WDATA =%0001000010000111
         GOSUB Send
    	NEXT ICOUNT
    	RETURN
     
    CLS: 
        'character=$0B       'SPACE
         TEMP1=0   ' LINECOUNTER
         TEMP =0    'CHARCOUNTER
    loop2:
        
    	WDATA = 0  ' LINECOUNTER*256 + CHARCOUNTER   ADDRESS
        GOSUB Send
        
    
    LOOP3:    '                :CHARACTERS        
    	WDATA = %0001011100001011  '     1011 0BH SPACECHARACTER
        GOSUB Send
    	TEMP = TEMP + 1
    	IF TEMP >= 28 THEN
        TEMP = 0
        TEMP1=TEMP1 + 1
    	ENDIF
    	IF TEMP1 >= 11 THEN SCREENBLANK
     	
        GOTO LOOP3
        
    SCREENBLANK:
    	RETURN
    
    GETSTVCHAR:                  'CONVERT ASCII TO STV
            STVCHAR =$7F   ' FORCES CLOCK PICTURE IF ERROR         
           LOOKDOWN ASCCHAR,["0123456789- ABCDEFGHIJKLMNOPQRSTUVWXYZ:./'abcdefghijklmnopqrstuvwxyz"],STVCHAR
                   RETURN 
    
    HEADER:
        LINECOUNTER=2       'SET START POSITION
        CHARCOUNTER=23      'SET CURSOR POSITION
        GOSUB SETLINE
        FOR CHARS2=0 TO 4
        READ CHARS2, ASCCHAR
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR
        NEXT
        RETURN
        
    NOVIDEO:
        LINECOUNTER=5       'SET START POSITION
        CHARCOUNTER=4       'SET CURSOR POSITION
        GOSUB SETLINE
        FOR CHARS2=6 TO 23      ' FROM EEPROM DATA
        READ CHARS2, ASCCHAR
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR
        NEXT
        RETURN
        
    TRYSYNCHS:
        
        PULSES=0
    
        COUNT SYNCH0,4,PULSES   '3MS SHOULD COUNT TO 2 OR 3
        IF PULSES > 0 THEN MIXED0
    FULL0:
    
        IF CURRENTMODE0=1 THEN RETURN
    
        WDATA=  %0000000011001110       'CONTROL REGISTER
        GOSUB SEND
        WDATA=  %0001101011010101   'NTSC
    
        
        
    '        WDATA=  %0001101011010101   'NTSC     BIT 8 = 0
                'CHANGE BIT 0 TO 1 FOR TEXT ONLY       OTIGINAL
                
     '     WDATA=  %0001101111010100
                'CHANGE BIT 0 TO 1 FOR TEXT ONLY        
        GOSUB SEND
    
    STAYHERE02:
      
        CURRENTMODE0=1
            GOSUB CLS
    GOBACK0:
        RETURN
    
    
    MIXED0:
        IF CURRENTMODE0=0 THEN RETURN
        WDATA=  %0000000011001110       'CONTROL REGISTER
        GOSUB SEND
        WDATA=  %0001100111010100    'ntsc
        
        
        
    '    WDATA=  %0001101011010100     'NTSC   BIT 8 = 0
        GOSUB SEND
    
    STAYHERE01:
    
        CURRENTMODE0=0
        GOSUB CLS
        RETURN
    Many thanks, Ed

    P.S. If you wish to e-mail me files my e-mail is [email protected]

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    You use highlite text, copy and paste as you would in word processing.

    To save the hex code ,put mouse at top left of hexcode, the pointer will change to something that looks like a capital I,the vertical part should just touch the left side of the colon on the top line, single left mouse click, use the slide bar on the right of the hex code to scroll down to the bottom of the code, move the mouse pounter to the last character, so the vertical part of the I just touches the right hand side of the F, hold the shift button down and then single left mouse click that will highlite the code, then Control C that will copy all the highlited text, now run notepad, right click on blank area and select paste, the hex code will appear, now save this as whatever name you wish with the extension as .hex. You can then load it into your programmer.

    I will look at trying your code tomorrow sometime.

    I would suggest you edit and mask your email as it will get picked up by the spam bots - write it as edcannady at earthlink dot net

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


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Hi Aerostar!
    Your hex code works (sort of). If there is no video then I get a blue screen with "NTSC" and NO SYNCHS RECEIVED"!
    If I input a video source then only the video input source displays with no text.

    Thank you for the e-mail recommendation, I get a ton of spam as it is!

    My code will not compile with the statement "@ device PIC16f628a,HS_OSC,BOD_ON,MCLR_ON,PWRT_ON"
    The 16F628A data sheet shows they made changes from MCLR TO MCLRE, ETC.
    I had to switch to #CONFIG and I believe it is completely wrong as the results when I change this cause things to go "spiritual" (technical term ).

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Quote Originally Posted by Ramius View Post
    Hi Aerostar!
    Your hex code works (sort of). If there is no video then I get a blue screen with "NTSC" and NO SYNCHS RECEIVED"!
    If I input a video source then only the video input source displays with no text.


    My code will not compile with the statement "@ device PIC16f628a,HS_OSC,BOD_ON,MCLR_ON,PWRT_ON"
    The 16F628A data sheet shows they made changes from MCLR TO MCLRE, ETC.
    I had to switch to #CONFIG and I believe it is completely wrong as the results when I change this cause things to go "spiritual" (technical term ).
    I will try and find a NTSC source to check the operation, I did connect a Pal video source to see what would happen, and it showed a black and white picture with the text overlaid.

    "@ device PIC16f628a,HS_OSC,BOD_ON,MCLR_ON,PWRT_ON" is for the earlier versions of PBP, before 3, I looked at the 16f628a .inc file (PBP260C) and it says mclr, if I compile with mclre it errors.

    Further to follow in due time.

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


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Thank you! I really appreciate all that you are doing. If there is something I can do please ask.

    Best, Ed

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


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Hi Aerostar!
    Okay so the code works (sort of)! If I give the STV5730 an NTSC source I only get the video from the source. Remove the source and I get the Blue screen with the "NTSC No Synchs Received message"!
    How can I get the text to overlay the incoming video?

    Thanks, Ed

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