Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] 16F628

Status
Not open for further replies.

fjpompeo

Advanced Member level 1
Joined
Nov 29, 2003
Messages
415
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
Brazil
Activity points
3,042
Unknown programming language

Can someone help me how to compile or generate HEX file of the language below? Unknown programming language, I have no idea what it is and have never seen it before.


Code:
Begin:  
        'PIC 16F628   WISSEL DMX RX/TX 8 KANALEN
       
        @ DEVICE PIC16F628,XT_OSC
        @ DEVICE PIC16F628,MCLR_OFF
        @ DEVICE PIC16F628,BOD_OFF
        @ DEVICE PIC16F628,LVP_OFF
        @ DEVICE PIC16F628,CPD_OFF
        @ DEVICE PIC16F628,PROTECT_ON
       
        DEFINE    OSC    4
               
        DEFINE HSER_TXSTA 24H
        DEFINE HSER_RCSTA 90H
        DEFINE HSER_SPBRG 4
        DEFINE HSER_CLROERR 1
       
        CMCON = 7

        TRISA    =    %00111111
        TRISB    =    %00000011
       
        ADRSA0        VAR    PORTA.0
        ADRSA1        VAR    PORTA.1
        ADRSA2        VAR    PORTA.2
        ADRSA3        VAR    PORTA.3
        ADRSA4        VAR    PORTA.4
        RX_TX        VAR    PORTB.0
        PININ        VAR    PORTB.1
        PINOUT        VAR    PORTB.2
        SELEKT        VAR    PORTB.3
        SEL0        VAR    PORTB.4
        WDAT        VAR    PORTB.5
        WCLK        VAR    PORTB.6
       
        GEGEVENS    VAR    BYTE[8]
        DUMMY1        VAR BYTE
        DUMMY2        VAR    BYTE
        DUMMY3        VAR    BYTE
        DUMMY4        VAR    BYTE
        DUMMY5        VAR    BYTE
        B1            VAR    BYTE
        I            VAR    BYTE
        DMXADRS        VAR    BYTE
        SCHAK        VAR    BYTE
        X            VAR    BYTE
        Y            VAR    BYTE
       
        Clear
       
               
        'CHECK IF IT'S AN INPUT OR AN OUTPUT CARD
                           
ERX:    IF RX_TX = 0 Then GoTo T_X

        'WAITING DATA FROM MASTER GET STARTED:
   
        SELEKT = 0
       
        HSerin 1,BEGIN,[WAIT("$"),B1]
        IF B1 = 0 Then GoTo VERDER
        GoTo BEGIN 
       
        'ADDRESS CORRESPONDES AND RECORD DATA
       
VERDER:    For I = 0 TO 7
            HSerin [B1]
            GEGEVENS(I) = B1
        Next
       
        'MAKE ROOM FOR DATA HERE
       
        DMXADRS = PORTA &%00111111
        X = DMXADRS / 8
        Y = DMXADRS // 8
       
        IF Y = 0 Then
            DUMMY1 = GEGEVENS(X)
            GoTo ERUIT
        EndIF
       
        For I = 1 TO Y
            DUMMY1 = GEGEVENS(X) >> 1
            DUMMY2 = GEGEVENS(X+1)
            DUMMY1.7 = DUMMY2.0
            GEGEVENS(X) = DUMMY1
            DUMMY2 = GEGEVENS(X+1) >> 1
            GEGEVENS(X+1) = DUMMY2
        Next       
   
           
ERUIT:
        GoSub DIGOUT_8

        GoTo BEGIN
   
DIGOUT_8: 'HEF4094
       
        SEL0 = 0
        WCLK = 0
        PauseUs 10
        ShiftOut WDAT,WCLK,1,[DUMMY1 \ 8]
        PauseUs 10
        SEL0 = 1
        PauseUs 10
        SEL0 = 0
        WCLK = 0
        PauseUs 10
        Return

T_X:
        TRISB.6 = 1
        DMXADRS = PORTA &%00011111
        IF DMXADRS = 0 Then DMXADRS = 64
       
        'HEF 4014
       
        SEL0 = 1
        PauseUs 5
        WDAT = 1
        PauseUs 5
        WDAT = 0
        PauseUs 5
        SEL0 = 0
        PauseUs 10
        ShiftIn WCLK,WDAT,0,[SCHAK \8]
        PauseUs 10
        GEGEVENS(0) = SCHAK
       
        SELEKT = 0
        HSerin 1,T_X,[WAIT("$"),B1]
        IF B1 = DMXADRS Then GoTo VDR
        GoTo T_X

VDR:
        PauseUs 300
        SELEKT = 1
        B1 = "$"
        GoSub DURUIT
        B1 = DMXADRS
        GoSub DURUIT
        B1 = GEGEVENS(0)
        GoSub DURUIT
        GoTo T_X

DURUIT:
        HSerout[B1]       
        Return
       
End:
 
Last edited by a moderator:

Yes definitely PICBASIC PRO according to used built-in commands like HSERIN. Curiously the @ DEFINE fuse statements are undocumented in PBP manual, but apparently supported.
 

Thank you very much. Just another observation is that the extention of the file is .PBP if this is of some help.
 

Hello
it seems to me the program use UART RX,TX. communicates with P.C . 8 bit data and is protected
"@ DEVICE PIC16F628,PROTECT_ON" .

kamal
 

About the fuse statements in PICBASIC compiler Presetting Configuration Fuses (PIC Defines) into your Program [Archive] - MEL PICBASIC Forum

According to the discussion, the @ DEVICE syntax is specific to PM assembler shipped with PICBASIC. If you use MPLAB assembler, you need to change the syntax. Not sure if recent PICBASIC PRO versions still provide the PM assembler.
--- Updated ---

Apparently recent PBP versions don't include the PM assembler. The fuse statement has to be changed to respective MPASM syntax. #config instructs PBP to override the default 16F628 fuse configuration.

Code:
        #config
        __config _XT_OSC & _MCLRE_OFF & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _CP_ALL
        #endconfig

You can download PBP, it works as trial version for 15 days. ME Labs, Inc. | 1-719-520-5323 | melabs.com Home Page
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top