A little HELP!!


Closed Thread
Results 1 to 40 of 77

Thread: A little HELP!!

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Hi!
    My code does not work!! NTSC. no longer displays which is understandable. The code complies and when I run it nothing is displayed! Must have missed something basic?

    Code:
    
    '****************************************************************
    '*  Name    : NTSC-1                                            *
    '*  Author  : Ed Cannady                                        *
    '*  Notice  : Copyright (c) 2017                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 06-30-17                                          *
    '*  Version : 1.0                                               *
    '*  Notes   : VIDEO IDENT                                       *
    '*          : WITH GREAT HELP FROM AEROSTAR                     *
    '****************************************************************
    
    ' WORKS USES SYNC FOR SWITCHING BETWEEN MIXED AND FULL TEXT MODE
    ' GOING FROM VID IN TO TEXT AND BACK TO VID IN
     
    #CONFIG
    
        __config _HS_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
        
    #ENDCONFIG
               
    define  OSC 20
       
    '---------------------------------------------------------------
    '16f628a  ED definitions
     
        TVSDA        VAR PORTB.4    '0     OUTPUT to pin 11 of stv chip 
        CS0     	 VAR PORTB.6    '0     OUTPUT to pin 13 of stv chip 
        TVSCL     	 VAR PORTB.5    '0     OUTPUT to pin 12 of stv chip 
        SYNCH0       VAR PORTB.7    '1     INPUT  to pin 7  of stv chip 
    '--------------------------------------------------------------- 
    
        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
        PRPM         VAR WORD
    
    '----------------------------------------------------------------     
    '    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   
     
        TRISB = %10001111
    
    '----------------------------------------------------------------     
    
        PAUSE 500
        
    	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:
        PRPM = 6789
        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 = %0001010000000000 + STVCHAR
    
    '               11 10 9 8  7654 3210
    ' WDATA = %0001 0  1  1 1  0000 0000 + STVCHAR
    
    ' bit 11 = character background 0 = disabled 1 = enabled       
    
    ' bit 10 = red
    ' bit 09 = green
    ' bit 08 = blue
    
    ' 000 = black
    ' 001 = blue
    ' 010 = green
    ' 011 = cyan
    ' 100 = red
    ' 101 = magenta
    ' 110 = yellow
    ' 111 = white
        
    ' bit 7 = blink 1=enable 0=disable    
        
        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
                'CHANGE BIT 0 TO 1 FOR TEXT ONLY
        GOSUB Send ' Control    ADDRESS 14
    '-------------------------------------------------------------    
    	WDATA = %0001011111001111
        GOSUB Send ' Position    ADDRESS 15
    '------------------------------------------------------------- 
    
       
    	WDATA = %0001000100101110 '$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=12      'SET START POSITION
        CHARCOUNTER=1       'SET CURSOR POSITION
        GOSUB SETLINE
    '    FOR CHARS2=0 TO 4
    '    READ CHARS2, ASCCHAR
        ASCCHAR = "P"
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR    
        ASCCHAR = "R"
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR    
        ASCCHAR = "P"
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR    
        ASCCHAR = "M"
        gosub GETSTVCHAR    'CONVERT ASCII TO STV
        GOSUB DISPLAYCHAR    
        ASCCHAR = PRPM DIG 1
        GOSUB DISPLAYCHAR    
        ASCCHAR = PRPM DIG 2
        GOSUB DISPLAYCHAR   
        ASCCHAR = PRPM DIG 3
        GOSUB DISPLAYCHAR    
        ASCCHAR = PRPM DIG 4
        GOSUB DISPLAYCHAR  
    '   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
    '   CHANGE BIT 0 TO 1 FOR TEXT ONLY  ORIGINAL
                
    '   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=  %0001101011010100
        GOSUB SEND
    
    STAYHERE01:
    
        CURRENTMODE0=0
        GOSUB CLS
        RETURN

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Some booboos from both of us !

    The DIG operation I got reversed, DIG 0 gives the units, DIG 1 the tens, and so on, the example I found on how it worked was ambiguous and I did say it was all untested in post 48.


    To get it on the screen the variable was wrong it needed to be changed from ASCCHAR to STVCHAR, but only for DIG use.

    HEADER:
    LINECOUNTER=12 'SET START POSITION

    There is no line 12 ! check the STV spec it has 11 rows so valid would be 0 - 10.

    I have put back the "NTSC" as that should always work, if what you have done after does not show but NTSC does then the problem must be in the new code addition.

    I found one wdata that had a bit incorrect and have corrected those, easily done if the codestudio cursor is in the wrong place and you type something.

    I would suggest small changes to the code, try it, if it works fine go on to next changes. Also perhaps save each version as you go with a number in the file name so you can easily go back to the last working.


    Base colour and text is back to white on blue as it was a setting I knew that worked.

    Try the enclosed hex file generated from Your post with corrections as above, files called NTSC-RPM. Works fine on my test boards.
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Again my greatest thanks! Two confusions, first the NTSC. only works with no video in and second the PRPM 6789 only displays with no video input!? I thought the "NOVIDEO" subroutine meant it was for when there is no video input?

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    With no incoming video you should have the NTSC the RPM and the NO SYNCHS DETECTED.

    With a video signal coming in you should have NTSC and the RPM only on the screen and overlaying the incoming video picture.

    I had reconverted by boards back to PAL, but have just changed just 1 back to NTSC and was using a PAL input for an incoming signal for test input.

    I have got hold of a Raspberry PI which can be set to output NTSC so will try that some time tomorrow to see if it works as it should.

    I wonder if you have your board correctly wired especially vin to vout pin 1 and 28 and no connection on vout2 pin 26, pins 20 to 23 grounded, pin 24 to 25 connected
    Last edited by aerostar; - 15th July 2017 at 18:43. Reason: Board wiring added

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


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    I believe everything is wired correctly. Yes pin 1 to 28 is connected. Pin 26 (Vout2) goes through a 3.3k resistor per the schematic and removing the resistor does not make a difference. Yes 20-23 are grounded. Before the software changes, NTSC. appeared both with video in and no video in. No video in will display the "No Synchs received" message with NTSC. and the PRPM 6789 message. Now with video in nothing is displayed almost as if our added code is in the wrong subroutine section?

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

    Hi!
    I took a previous version and inserted the additional code and it worked sort of! The PRPM now appears in both the mode with a video input and without a video input! You wrote "I found one wdata that had a bit incorrect and have corrected those, easily done if the codestudio cursor is in the wrong place and you type something." Not sure which or where so maybe this was the cause? There is something else I cannot seem to change and that is the size of the characters! You can see in the code I changed the zoom register to all zeros which should make the characters the smallest possible, however any line number greater than line 8 is off the screen! Is there more than one register I need to change?

    Thanks, Ed

    P.S. attached is the code without the wdata bit change.
    Attached Files Attached Files

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Looks like we both doing the same thing, attached is my corrected version

    I have tested this with NTSC output from RPi and it switches and displays correctly.

    I have moved the text, also the RPM and NTSC so that it only appears when there is incoming video.

    Regarding the text size I think you will have to play with the POSITION REGISTER - never tried that but that should do something. The STV data sheet does not give much idea as to what that does !

    Use my hex file and see if it works on yours.

    Should have changed the file name - memory lapse.
    Attached Files Attached Files

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