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

    Some "Con" statements left over from debug etc code that was stripped out as I said somewhere earlier, and were also used as memory jogger.

    NTSC. will appear as this program always sends on screen refresh regardless of whether there is video input or not, it is down to you what you wish to be displayed with or without incoming video, it was for video repeater ident.


    This is the part you need to understand about placing text on screen

    HEADER:
    LINECOUNTER=2 'SET START POSITION ********* line 3 from top (0-2 = 3!)
    CHARCOUNTER=23 'SET CURSOR POSITION***********Character position start 23rd from left
    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

    with regards to getting your RPMs on screen the DIG command would probably help,

    so if you had a reading of 2400 as rpm in a word byte RPM, I THINK (following is UNTESTED)

    ASCCHAR = RPM DIG 1
    This gives a value of 2, and as it happens the character matrix in the chip will display 2 as if you look at the table the numbers come first

    then
    GOSUB DISPLAYCHAR

    then

    ASCCHAR = RPM DIG 2
    This gives a value of 4

    and so on to dig 4, you could make a loop to do this.

    Not quite sure what happens if the value is below 1000, but you could easily check that prior to doing DIG 4 and put a blank there instead, skipping the DIG 4.

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

    Thank you and I am feeling incredibly stupid right now, even after 4 Excedrin's! I think I understand part of this, "RPM" is the variable where the RPM reading is stored? "DIG" is the number of digits to be displayed? So RPM DIG 4 would display 4 digits? Where do you inset the "ASCCHAR = RPM DIG 4? I think this line goes after "GOSUB SETLINE"? Then how do you display "RPM" in front of the reading? Please excuse what seems to be basic, simple questions and once I stop having brain craps things should get better!

    Ed

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Quote Originally Posted by Ramius View Post
    Thank you and I am feeling incredibly stupid right now, even after 4 Excedrin's! I think I understand part of this, "RPM" is the variable where the RPM reading is stored? "DIG" is the number of digits to be displayed? So RPM DIG 4 would display 4 digits? Where do you inset the "ASCCHAR = RPM DIG 4? I think this line goes after "GOSUB SETLINE"? Then how do you display "RPM" in front of the reading? Please excuse what seems to be basic, simple questions and once I stop having brain craps things should get better!

    Ed
    If I asked you what the 2nd digit was of 2400 (normal reading left to right) you would immediately tell me 4 - congratulations you have just done a DIG 2,

    RPM is a variable name suggested where you would store the reading from whatever interface you have on the motors.


    DIG X just gives you the value of the single digit starting from the left hand side.

    so if as I said above your RPM was 2400

    DIG 4 would return 0 ie the last digit of 2400.

    DIG 2 would return 4 ie the second digit


    You set the line where you want the data to be shown
    set the cursor where you want the first character of your data to start



    For "RPM" in front

    ASCCHAR="R"
    GOSUB GETSTVCHAR 'CONVERT ASCII TO STV
    GOSUB DISPLAYCHAR

    repeat the above 3 lines for "P", "M" and " "


    now use the RPM word variable where you have stored your reading (RPM for instance)

    ASCCHAR = RPM DIG 1
    This gives a value of 2, and as it happens the character matrix in the chip will display 2 as if you look at the table the numbers come first

    then
    GOSUB DISPLAYCHAR

    then

    ASCCHAR = RPM DIG 2
    This gives a value of 4
    GOSUB DISPLAYCHAR


    ASCCHAR = RPM DIG 3
    This gives a value of 0
    GOSUB DISPLAYCHAR

    ASCCHAR = RPM DIG 4
    This gives a value of 0
    GOSUB DISPLAYCHAR


    so on the screen at the line you have selected starting at the position you have selected, you would have RPM 2400

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

  5. #5


    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

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

    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?

  7. #7


    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

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