trying to decide on pbp


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Which chip are you planning to start with?

    What do you have for a programmer?
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Which chip are you planning to start with?

    What do you have for a programmer?
    First project for PBP will be 16F1946 interface card for parallel port to steppers, also handling limit switches, homing and such. Past projects were based around 16f676 or 16f818

    I am using ICD3 for my programmer/debugger.

    Don't get me wrong, I am NOT looking for folks to write my program. I have all the pins defined. I don't have the board drawn up yet, I like to see if my pin assignments need to change for some reason.

    Here is what I am looking for, in MPASM, I know I have to start with an include for the chip. then I always cblock ram, and .org the start of my program. from there its code away!

    So I asume there are some basic must haves that will appear in the start of any PBP program. I will look over all the examples to start figuring this out.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cncmachineguy View Post
    So I asume there are some basic must haves that will appear in the start of any PBP program. I will look over all the examples to start figuring this out.
    Hi CNC

    Find here a ( detailed ! ) Header for PBP program :
    Code:
    '*****************************************************************************
    '*****************************************************************************
    '
    'PIC 18F2520 @ 4Mhz + Horloge EXT 32 768 Hz sur TMR1 ( interruptions @ 1Hz )
    'Compte-Tours avec Capture sur TMR3 avec Horloge système / 8.
    '
    'Afficheur LCD 2*8 sur PORTD
    '
    ' 3745 Lignes assembleur
    '
    '*****************************************************************************
    '*****************************************************************************
    '
    'Defines
    '*****************************************************************************
    DEFINE OSC 4
    DEFINE BUTTON_PAUSE 250 
    DEFINE ADC_BITS 10
    'DEFINE LCD_COMMANDUS 2000
    'DEFINE LCD_DATAUS 50
     
    ' Define LCD connections
    DEFINE LCD_DREG PORTC    ' Set LCD Data port
    DEFINE LCD_DBIT 4        ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB   ' Set LCD Register Select port
    DEFINE LCD_RSBIT 5       ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB    ' Set LCD Enable port
    DEFINE LCD_EBIT 6        ' Set LCD Enable bit
    DEFINE LCD_BITS 4        ' Set LCD bus size (4 or 8 bits)
    '
    '
    '*****************************************************************************
    ' Constantes
    '*****************************************************************************
    ExtOSC   con 32768  'Quartz Horloge "temps" en Hz
    Tension_  con 0   'Correspondance pour Canaux ADC
    TempA_  con 1
    TempH_  con 2
    Dureetonte con 1  ' de -1h à +59 mn ... ( 1/2 durée !!! )
    Kelvin  con 273
    '***************************  seuils Alarmes  ********************************
     
    AlmVolt  con 15 * 100 '>=  Tension trop élevée   1/100 V
    AlmRpm  con 3600   '>=  Régime trop élevé   T/Mn
    AlmAir  con 90  + 273 '>=  Temp Air Trop élevée  °K ^ 82
    AlmHuileL con 0   + 273 '<=  Temp Huile trop basse  °K
    AlmHuileH con 100 + 273 '>=  Temp Huile trop élevée  °K
    '**************  Periodicités d'Entretien ( ordre croissant ! )  *************
    Service1 con 10 ' Heures
    ServiceV con 20    
    Service2 con 25
    Service3 con 50
    Service4 con 100
    Service5 con 300
    VERSION  con 1   'N° de la révision
    DATA (0),0 (29) 'Raz des Mémoires si reprogrammation
    '*****************************************************************************
    ' 1er préchargement 85H30M43S le 03/02/2010
    '*****************************************************************************
    DATA @0, VERSION
    DATA @4, $1     ' Affichage maintenance ?
    DATA @6, $55     
    DATA @8, $0     ' 85 Heures
    DATA @10,$1E    ' 30 Minutes
    DATA @12,$2B    ' 43 Secondes
    DATA @14,$B8
    DATA @16,$0B    ' 3583 Tr/mn
    DATA @22,$3C    
    DATA @24,$0     ' 83°C Air
    DATA @26,$3C    
    DATA @28,$0     ' 89°C Huile
     
    '*****************************************************************************
    '*****************************************************************************
    'Config processeur
    '*****************************************************************************
    '
    @   __CONFIG    _CONFIG1H, _IESO_OFF_1H & _OSC_XT_1H & _FCMEN_OFF_1H
    @ __CONFIG _CONFIG2L, _BOREN_OFF_2L & _PWRT_ON_2L
    @   __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
    @   __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_PORTBE_3H
    @   __CONFIG    _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L & _XINST_OFF_4L
    @   __CONFIG    _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
    @   __CONFIG    _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    @   __CONFIG    _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
    @   __CONFIG    _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H 
    @   __CONFIG    _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
    @   __CONFIG    _CONFIG7H, _EBTRB_OFF_7H 
    '*****************************************************************************
    'Config Osc
    OSCCON  = %01100000
    '*****************************************************************************
    'Config TIMERs
    T0CON = %00000010 ' 16Bits 1/8 prescaler, Horloge Système, OFF
         ' Utilisé pour détection sous regime ou arret
     
    T1CON = %00000000 '1/1 prescaler, Quartz 32,768
    ' *** Géré par Elapsed Timer ***
    T3CON = %01110001 ' CCP SUR TMR3,1/8 prescaler,Horloge système,ON
         ' Mesure de la vitesse
    '*****************************************************************************
    'Config CCP1 arret CCP2
    CCP1CON = %00000101 ' Capture sur front montant 
    CCP2CON = %00000000 'inhibition module CCP2
    '*****************************************************************************
    'Inhibition SSP
    SSPCON1.5 = 0
    '*****************************************************************************
    'Inhibition Comparateurs
    CMCON = 7
    '*****************************************************************************
    'Inhibition Reference interne
    CVRCON = 0
    '*****************************************************************************
    'Config Interruptions
    INTCON  = %10000000
    INTCON2 = %11110000
    INTCON3 = %00000000
    PIE1    = %00000100
    PIE2    = %00000000
    IPR1    = %00000001
    IPR2 = %00000000
    RCON = %10000000
    '*****************************************************************************
    'Config ADC
    '*****************************************************************************
    ADCON0 = %11000000  ' 
    ADCON1 = %00011100   ' A0 > A2 Vref+ A3, Vref- = Vss 
    ADCON2 = %10100110  ' Right Just., 8Tad, clock /64
    '*****************************************************************************
    '*****************************************************************************
    'Config et Prepositionnement E/S
    '*****************************************************************************
    PORTA = %00110000
    PORTB  = %00010000
    PORTC = %00001000
     
    TRISA  = %00011111
    TRISB = %00000110
    TRISC = %00000111
     
    '
    '*****************************************************************************
    'Alias E/S
    '*****************************************************************************
    'MCLR/ sur Broche 1 par R/C/D
    Voltage  var PORTA.0  'TENSION Batterie / 4
    TempA  var PORTA.1  'LM335 Temp Air
    TempH  var PORTA.2  'LM335 Temp Huile
    Vref  var PORTA.3  'TL431 = 4.096v ...
    Raz   var PORTA.4  'JUMPER Raz/Programmation
    AlRef  var PORTA.5  'Alimentation référence TL431 + capteurs
    Buzzer  var PORTB.0 
    Contact  var PORTB.1  ' + 12 v sous clé ( / 4 = 2 - 4 v !!! )
    Selection  var PORTB.2  'Poussoir sélection Affichage
    Signal  var PORTB.3  'Sortie Survitesse
    AlLCD  var PORTB.4  'Alimentation LCD BS 250 !!! 0 = ON : 1 = OFF
    RS   var PORTB.5
    E   var PORTB.6
    Alm   var PORTB.7  'Sortie Alarme
    '   var PORTC.0  'Qz 32768
    '   var PORTC.1  '   "
    Speed  var PORTC.2  'Entrée compte-tours 1C/4T
    Alim  var PORTC.3  'Autoalimentation
    D4   var PORTC.4
    D5   var PORTC.5
    D6   var PORTC.6
    D7   var PORTC.7
     
    '*****************************************************************************
    'Types Variables
    '*****************************************************************************
    '
    Result  var WORD
    Volt  var WORD
    Tension  var WORD
    Tensionmoy var WORD
    Tair  var WORD
    TAMax  var WORD  ' Valeur Maxi Split
    TairMax  var WORD  ' Valeur Maxi mémorisée
    Thuile  var WORD
    THMax  var WORD  ' Valeur Maxi Split
    THuileMax var WORD  ' Valeur Maxi mémorisée
    Dummy  var WORD
    Capture  var WORD
    CaptureOld var WORD
    Vitesse  var WORD
    Vitessemoy var WORD
    VitesseMax var WORD  ' Valeur Maxi mémorisée
    VitMaxSpl var WORD  ' Valeur Maxi Split
    Periode  var WORD
    Periode2 var WORD
    MaxPeriode var WORD  ' Pour calcul DIV32 ...
    HoursT  var WORD  ' Memorisation Heures totales
    HoursG  var WORD
    Service  var WORD
     
    LSelect  var BYTE
    SecondsT var BYTE  ' Mémorisation Secondes Totales
    MinutesT var BYTE  ' Mémorisation Minutes Totales
    AddH  var BYTE  ' Retenue 60M ...
    AddM  var BYTE  ' Retenue 60s
    Delay  var BYTE
    I   var BYTE
    RazT  var BIT
    Buzz  var BIT
    Reveil  var BIT
    Flagged  var BIT
    Display  var BIT
     
    INTCON.7  = 0    'Désactivation interruptions
    Alim    = 1    'Autoalimentation
    AlLCD   = 0    'Mise sous tension LCD
    Alref   = 1    'Mise sous tension référence
    PAUSE  500
    LCDOUT $FE,1                  ' Initialize LCD
    CLEAR
    Periode2 = 3000
    dummy = 2500*Periode2   'Juste Pour éviter de ralentir l'interruption ...
    MaxPeriode = DIV32 AlmRpm
     
    '*****************************************************************************
    'Includes
    '*****************************************************************************
    INCLUDE "DT_INTS-18.bas"
    INCLUDE "ReEnterPBP-18.bas"
    INCLUDE "Elapsed_INT-18_ExtOsc.bas"  ; Elapsed Timer Routines
    ASM
    INT_LIST_H  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    TMR1_INT,  _ClockCount,   PBP,  yes
         INT_Handler    CCP1_INT,  _Period,       PBP,  yes
     
        endm
        INT_CREATE_H            ; Creates the interrupt processor
    ENDASM
    ...
     
    Main: ' " active " code now
    as you see ... it's not too far from assembler but banks selecting ( if any ...) and other " details " ( memory maps, "multibyte" variables types ...) are held by PBP ...

    note this one is rather long due to the use of all pins and most of the peripherals ... ( just serial link missing ! )

    Alain
    Last edited by Acetronics2; - 25th August 2010 at 13:15.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Thank You and sorry

    the sorry is cuz I noticed I have some folks names mixed up.

    The thank you is for that wonderful example of a header. Also its great to know PBP tends to the banks and such. So basically we get to code as though there are no banks. that takes loads of housekeeping out of the equation.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cncmachineguy View Post
    So basically we get to code as though there are no banks. that takes loads of housekeeping out of the equation.
    Exactly ... you got it !!! no " Banksel " or " Pagesel " to use. Compiler just will warn you if you cross pages ... just warns if some assembler lines are in the vicinity !

    and PBP Basic language is based on already written Macros ... so, you just have to " call " them one after the other.

    no housekeeping for page crossing nor I/O changing if the command implies it, ( One wire commands i.e - the macro drive them as required by itself - ) ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Thank you everyone, I received my software today and will start to play with it soon. As I come upon questions, I will post with new threads assuming the answer is not already here.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default welcome

    Bert, good choice

    There are some really helpful people here, often prepared to answer basic as well as complex questions, and if they have been asked before and buried in the archives will often point you in the right direction.

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