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

    Okay so I did just the one bit change making it $1EC5. It helped. the $1FD4 I made $1ED4. Some how the video with text is being placed below the sync level! I can see sync, burst, and the video appears to be below the sync pulse! The sync pulse should be a negative .3 volts while video is positive .7 volts. Maybe I have a bad chip? There is also a "Mode Register" and I thought it had a value of $00CC and I think I am looking at the wrong register?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Hi Ed,
    If you're talking about the line WData = $00CC: GOSUB Send it's a command that makes the address pointer in the chip point at address 12 (which apparently is the Zoom register and makes the pointer increment automatically for each data write following the command. The mode register is at address 16 so, as far as I can see, it is being set to either $183E or $193E depending on which of the two subroutines are being called.

    /Henrik.

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

    Hi Henrik!
    Again thank you, thank you, thank you! Some settings do not make any sense to me. $183E for example sets M8 to a low impedance state while $193E sets M8 to a high impedance state. It would seem that M8 should be high impedance at all times. I did try to e-mail the author and the e-mail bounced. The first picture is of the video out. Note the bar at the bottom which is below the sync level and should be at the top. Second picture shows what a TV will display. The third photo shows the input video (color bars). Note nothing is below the sync level.
    Attached Images Attached Images    

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    I'm afraid I don't know how it's supposed to configured to do what you want and I don't have much experience with composite video signals. All I can do is read the datasheet....

    /Henrik.

  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 Henrik!
    Not a problem, at least you are not working with the new digital format of video signals! There are just a bunch of settings that are possible and why certain choices were made make absolutely no sense to me. For example, unless you have some type of noise problems, low impedance is rarely used. In the mode register there is an option to use the BAR pin and a CSYNC pin which suggests to me you can input your incoming video signal and use it as a reference for the sync pulses. The M7 bit appears to output the video in signal which to me would say it ignores any text insertion i.e. bypasses the function of the chip. Since I am also a ham radio operator (WB6NSN) the guy who wrote the program is also a ham (F6CSX) so I will try his e-mail address list on the international ham radio listing. Hopefully he knows English. I certainly do appreciate more than I can express my sincerest thanks for all your help. Just for informational purposes only, in the first picture, the three what look like bars is called color burst as is a reference signal to make sure the colors are correct. Just before the bars are the horizontal sync pulses which go down, across, and up much like a 3 sided rectangle. Below the sync pulses should only be the vertical sync pulses and it is showing the text video which should be above the horizontal sync pulse level. No idea why the video is looking like this or how it went negative. I am not giving up yet! Best, Ed

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: A little HELP!!

    Hi, I have dug out some code I used for this chip, but it is PAL, you should be able to change the appropriate bit(s) to NTSC.

    It puts the word TEST. on 3rd line at right hand side of the screen.

    It also detects synchs and will auto switch mode as necessary, and when there is no incoming video it will display that No Synchs message on screen.

    I have modified the code from the original, it had a lot of debug stuff in it, I have not tested since although it should work, (it compiles OK) , I post to let you check the values in the code you have.

    I will try and test in the next few days when I get some video stuff resurected.

    Just a note it is much easier to put the values in as binary eg %0000000011001100 rather than have to work it out when debugging.

    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 
    
            INCLUDE "ALLDIGITAL.pbp"
            
        define  OSC 4
        
         
    'TV CHIP CONNECTIONS
     
    
     
    '---------------------------------------------------------------
    
     '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,"TEST.",$FF,"NO SYNCHS RECEIVED",$FF   
    
    
    
    '---------------------------------------------------------------- 
    '628
      TRISB=%10011100
    '----------------------------------------------------------------     
    
    
        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=  %0001101111010100
                '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=  %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=  %0001101111010100
        GOSUB SEND
    
    STAYHERE01:
    
        CURRENTMODE0=0
        GOSUB CLS
        RETURN
    Darrel Taylor ALLDIGITAL.pbp if you do not have it.

    Code:
    ;***************************************************************************
    ;*  Name    : ALLDIGITAL.pbp                                               *
    ;*  Author  : Darrel Taylor                                                *
    ;*  Notice  : Copyright (c) 2009                                           *
    ;*          : All Rights Reserved until Abused                             *
    ;*  Date    : 4/30/2009                                                    *
    ;*  Version : 1.5 (3/7/2011)                                               *
    ;*  Notes   : An INCLUDE file that will automatically enable               *
    ;*          : all DIGITAL Inputs multiplexed with the ADC or Comparators   *
    ;*          : Works with ANY PIC, using either PM or MPASM                 *
    ;***************************************************************************
    ;*  Useage  : INCLUDE "AllDigital.pbp"                                     *
    ;*          :   yup, that's it. Just include the file and it's All Digital *
    ;*          : Adding this line to your program will display the values     *
    ;*          :   used to achieve AllDigital ... (if using MPASM)            *
    ;*          :   DEFINE SHOWDIGITAL 1                                       *
    ;***************************************************************************
    ;*  Versions: 1.0 - Initial release                                        *
    ;* 5/6/2009 : 1.1 - Added Shared address SFR support for 18F87J50 family   *
    ;*          :       Thanks to mister_e                                     *
    ;* 5/9/2009 : 1.2 - Removed MPASM specific opcode (variable), for PM.exe   *
    ;*          :       Thanks to Tobias                                       *
    ;* 7/11/2009: 1.3 - Added ANSELA,ANSELB,ANSELD,ANSELE for the 16F72x series*
    ;* 7/19/2010: 1.4 - Added ANSEL0 and ANSEL1 for the 18F4431 series.        *
    ;*  3/7/2011: 1.5 - Update for latest chips from Microchip                 *
    ;***************************************************************************
    
    ;Check 18F45k80 ----
    ; Uses ANCONx with ANSEL0 and ANSEL1 as bit names
    ; other PIC's have ANSEL0 and ANSEL1
    
    ASM
    ;----[Module defaults]------------------------------------------------------
      #define SHOWDIGITALDEFAULT  0
      ifdef SHOWDIGITAL
    SHOWDIGITALRESULT = SHOWDIGITAL
      else
    SHOWDIGITALRESULT = SHOWDIGITALDEFAULT
      endif
      ifndef PM_USED
        ifndef ADLISTALL
          nolist
        endif
      endif
      
    ;----[Attempt to Set a registers Value]-------------------------------------
    SetReg  macro RegOut, Cin
        ifndef PM_USED
          ifndef ADLISTALL
            nolist
          endif
        endif
        
        ifdef RegOut
          ifndef PM_USED
            list
          endif
          MOVE?CB  Cin, RegOut
          if (SHOWDIGITALRESULT == 1)
            ifndef PM_USED
              messg RegOut = Cin
            endif
          endif
          ifndef PM_USED
            ifndef ADLISTALL
              nolist
            endif
          endif
        endif
      endm
      
    ;----[A/D Converter registers]----------------------------------------------
    HasANSEL = 0
      ifdef ANSEL
    HasANSEL = 1
        SetReg  ANSEL , 0             ; if chip has ANSEL's, clear them
      endif
      ifdef ANSEL0
        ifndef ANCON0
    HasANSEL = 1
            SetReg  ANSEL0, 0
        endif
      endif
      ifdef ANSEL1
        ifndef ANCON0
    HasANSEL = 1
          SetReg  ANSEL1, 0
        endif
      endif
      ifdef ANSELA
    HasANSEL = 1
        SetReg  ANSELA, 0
      endif
      ifdef ANSELB
    HasANSEL = 1
        SetReg  ANSELB, 0
      endif
      ifdef ANSELC
    HasANSEL = 1
        SetReg  ANSELC, 0
      endif
      ifdef ANSELD
    HasANSEL = 1
        SetReg  ANSELD, 0
      endif
      ifdef ANSELE
    HasANSEL = 1
        SetReg  ANSELE, 0
      endif
      ifdef ANSELF
    HasANSEL = 1
        SetReg  ANSELF, 0
      endif
      ifdef ANSELG
    HasANSEL = 1
        SetReg  ANSELG, 0
      endif
      ifdef ANSELH
    HasANSEL = 1
        SetReg  ANSELH, 0
      endif
      ifdef ANSELI
    HasANSEL = 1
        SetReg  ANSELI, 0
      endif
      ifdef ANSELJ
    HasANSEL = 1
        SetReg  ANSELJ, 0
      endif
      ifdef ANSELK
    HasANSEL = 1
        SetReg  ANSELK, 0
      endif
      if (HasANSEL == 0)
        ifdef ANCON0                  ; Several chips use ANCON0 and ANCON1
          ifdef ADSHR                 ; if chip has shared address SFR's
            MOVE?CT  1, WDTCON,ADSHR  ;   switch to shared address registers
            if (SHOWDIGITALRESULT == 1)
              messg WDTCON.4 = 1
            endif
          endif
          SetReg  ANCON0, 0xFF        ;  
          ifdef PCFG15                ;  0 = Analog with these bits
            SetReg  ANCON1, 0xFF
          else
            SetReg  ANCON1, 0x7F
          endif
          ifdef ADSHR                 ; if chip has shared address SFR's
            MOVE?CT  0, WDTCON,ADSHR  ;   put SFR's back to legacy
            if (SHOWDIGITALRESULT == 1)
              messg WDTCON.4 = 0
            endif
          endif
        else
          ifdef PCFG6                 ; Some chips use ADCON1 bits
            SetReg ADCON1, 0x7F       ;  the same way as ANCONx
          else
            ifdef PCFG3               ; if there's a PCFG3 bit
              ifdef ADCON2            ;  but has no ADCON2, more than 8 A/D's
                SetReg  ADCON1, 0x0F  ;   A/D cfg from table = 0x0F
              else
                SetReg  ADCON1, 7     ; most common, 8 or less A/D ch's
              endif
            else
              ifdef PCFG2
                ifdef ADCON1
                  SetReg  ADCON1, 7   ; A/D is 8-bit, 5 ch's
                endif
              else
                ifdef ADCON0          ; if there's an ADCON0
                  ifndef ADCON1       ;  but not an ADCON1
                    SetReg  ADCON0, 0 ;  A/D is 8-bit and ADS bits are in ADCON0
                  endif
                endif
              endif
            endif
          endif
        endif
      endif
        
    ;----[Comparators]----------------------------------------------------------
      ifdef CMCON
        ifdef CMEN0       ; 18F1230/1330
          ;SetReg CMCON, 0 ; default already
        else
          ifdef CM2
            SetReg CMCON, 7
          else
            ifdef PM_USED
              "ALLDIGITAL: CMCON value not found"
            else
              messg "ALLDIGITAL: CMCON value not found"
            endif
          endif
        endif
      endif
      
      ifdef CMCON0
        ifdef NOT_COUTEN            
          SetReg CMCON0, 0xF1       ; 10F204/206
        else
          ifdef CMCH
            SetReg CMCON0, 0        ; 12F609/615
          else
            ifdef CM2
              SetReg CMCON0, 7      ; 12F635/683, 
            else                    ; 16F636/639/684/688/913/914/916/917/946
              ifndef PM_USED
                "ALLDIGITAL: CMCON0 value not found"
              else  
                messg "ALLDIGITAL: CMCON0 value not found"
              endif  
            endif
          endif
        endif
      endif
      
      ifdef CM1CON0                 ; individual comparator controls
        ifdef NOT_C1OUTEN           
          SetReg CM1CON0, 0xF1      ; 12F510/506, 16F526
        else
    ;      SetReg CM1CON0, 0         ; these already default to 0 --------------
        endif                       ; 16F882/883/884/886/887/ 610/616
      endif                         ; 16F631/677/685/687/689/690
                                    
                                    ; these aren't 0, but default to OFF
                                    ; 18F24J11/25J11/26J11/44J11/45J11/46J11
                                    ; 18F24J50/25J50/26J50/44J50/45J50/46J50
      ifdef CM2CON0
        ifdef NOT_C2OUTEN            
          SetReg CM2CON0, 0xF1
        else
    ;      SetReg CM2CON0, 0         ; already default to 0 -----see above-
        endif
      endif
        
    ; CM1CON                      ; these aren't 0, but default to OFF
                                  ; 18F65J50/66J50/66J55/67J50/66J11/66J16/67J11
    ; CM2CON                      ; 18F85J50/86J50/86J55/87J50/86J11/86J16/87J11
    
      ifndef PM_USED
        list
      endif
    ENDASM

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

    Thank you! Thank you! Thank you! It will be exciting to try it.

    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