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

    Hi,

    I have compiled and programmed a 16f628a and it all works fine.

    Pics a bit fuzzy due slow shutter.

    Remember the code posted is the PAL version you need to change the bit(s) for NTSC.

    Cannot test on NTSC as no suitable equipment.


    Name:  STV-OVERLAY.JPG
Views: 2778
Size:  246.1 KBName:  STV-TEXTMODE.JPG
Views: 2790
Size:  275.8 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!!

    Wow! Looks Great! Would you know which bits to change? I ask since I was not successful with my previous program.

    Thanks, Ed

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    looks like it is bit 8 of control regester for NTSC



    Search for %0000000011001110

    Immediately below you will see gosub send, this points the chip to address 14

    the next instruction is the actual values that are to be sent
    change bit 8 to be a 0

    There are 3 places I think that need to be changed

    in label FULL0: and MIXED0: and INIT:

    FULL0:

    IF CURRENTMODE0=1 THEN RETURN

    WDATA= %0000000011001110 'CONTROL REGISTER
    GOSUB SEND
    WDATA= %0001101111010101 ' <<<<< change bit 8 to 0 (far right is bit zero)


    FULL0:

    IF CURRENTMODE0=1 THEN RETURN


    WDATA= %0000000011001110 'CONTROL REGISTER
    GOSUB SEND
    WDATA= %0001101111010101 ' <<<< change bit 8 to a 0 (far right is bit zero)


    In the init routine look for this

    WDATA= %0001101111010100 ' change bit 8 to a 0 (far right is bit zero)
    'CHANGE BIT 0 TO 1 FOR TEXT ONLY
    GOSUB Send ' Control ADDRESS 14


    I do not think anything else needs to be done - but I could be wrong.!!

    The init routine for the chip under certain circumstances will auto up the address, that is why there is no
    WDATA= %0000000011001110 'CONTROL REGISTER
    prior to it.

    Sorry cannot help much more on the settings.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Looks likely I can run a partial test on NTSC, I have found the appropriate crystal deep in the odd box, and I have the possible loan of a multi monitor, it is rather old but if it still works it will do NTSC.

    I have found the original picbasic files on the web, and that compiles fine for 16F628a. The only thing I have to change are the port numbers to suit my pic/sstv board, all operations will be unchanged.

    I do not have a NTSC source, so it would not be a full test, but if text appears, then that should at least prove the NTSC side is working.

    It will be a few days before I get the chance to do this.

    In the meantime please post if you get your board working on NTSC.

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

    Hi Aerostar!
    I cannot tell how much I appreciate what you are doing! The same as you I have to make some port changes to accommodate wiring. I think I set the TRISB settings correctly and well as the register changes you recommended. This is probably going to sound strange and when I run the code it gets stuck (stops) at "Pause 500"! not sure why?
    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
    
    INCLUDE "ALLDIGITAL.pbp"
            
    define  OSC 20
    
    #CONFIG
        __config _HS_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG
    
            
    'TV CHIP CONNECTIONS
     
     
    '---------------------------------------------------------------
    
     '16f628a
     
     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
    '---------------------------------------------------------------
    
        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,"TEST.",$FF,"NO SYNCHS RECEIVED",$FF   
    
    
    
    '---------------------------------------------------------------- 
    '628
      TRISB=%10000100
    '----------------------------------------------------------------     
    
    
        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
                '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=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 ' was 0001101111010101
       '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=  %0001101011010101  'was 0001101111010100
        GOSUB SEND
    
    STAYHERE01:
    
        CURRENTMODE0=0
        GOSUB CLS
        RETURN

    I hope I pasted the code correctly this time!!!

    Best, Ed

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Have just glanced at your code, first thing I noticed was


    You have 2 declarations for Port B.6 this may well be your problem

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


    I will have another look tomorrow as it is bedtime over here (UK) and I am tired.


    Thought.... as you are only using digital ports PORT B you do not need the include file.
    The file just makes all Analog ports digital - it works fine on 628a and others BUT may not work on newer chips, as I mostly use these or similar.
    Last edited by aerostar; - 22nd June 2017 at 23:20. Reason: Added info re Alldigital

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

    I will try that a little later. Right now the program freezes right after the TRISB statement at the Pause 500. Comment out the Pause 500 at it stops at the High Heartbeat! I am so confused!

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