Advice please - Warning message


Results 1 to 40 of 51

Threaded View

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

    Default Advice please - Warning message

    Hi guys and gals,

    I'm playing with PBP and the 18F2550 pic (as I had one to hand), and just trying to do some basic LED flashing as a start for a new version of an old project.

    I've downloaded the latest patch for PBP 2.46, and the latest version of Microcode studio. I'm also using MPASM (I've used MPLA 7.31 as I've just re-ghosted the PC and that was what was on it at the time I made the ghost image )

    I've ported some code I used for a previous vesion of this project based on a 16F628a into a blank page in microcode studio and compiled it. It through out several warnings, which with the help of the search function of this forum I've resolved by editing the INC file. However it now compiles fine, but shows a warning.

    I know that warnings don't affect the operation of the code, but I would like to know what it means so as to further my knowledge. I'm still a noobe when it comes to working with different chips and although I've looked at the datasheet it still makes little sence. I assume that its because the 18F has a different number of bits in its words or something ??

    Anyway, here's the code

    Code:
    ;************ set up PIC *****************
    PORTA = 0                        ' declare port level BEFORE port direction = safe power-on
    CMCON = 7                        ' PortA Digital inputs
    CCP1CON = 0                      ' PWM off
    
    
    
    TRISA=%11100111                  'set PORTA as all input apart from A3 & A4
    TRISB=%00000000                  'set PORTB as all output
    
    @RC_OSC_NOCLKOUT 
    @WDT_ON
    @PWRT_ON
    @MCLR_OFF
    @BOD_ON
    @LVP_OFF
    @CPD_OFF
    @PROTECT_OFF
    
    ;************* set up pattern data **********
        
    Patt1 DATA 16,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1 
    Patt2 DATA 8,129,66,36,24,24,36,66,129 
    Patt3 DATA 16,1,3,2,6,4,12,8,24,16,48,32,96,64,192,128,0 
    Patt4 DATA 16,1,128,2,64,4,32,8,16,8,32,4,64,2,128,1,0 
    Patt5 DATA 12,24,60,126,255,231,195,129,0,129,195,231,255 
    Patt6 DATA 13,1,2,4,8,17,34,68,136,16,32,64,128,0 
    Patt7 DATA 8,128,64,32,16,8,4,2,1
    
    ;************* set up varibles ************
        
    i var byte                          ;used for for next loops
    D var byte                          ;used to store the result of the pot on port A1 and thus set timing delay
    scale var byte                      ;used in the POT command
    Scale = 254                         ;used to set range 
    SW1 var PORTA.6                     ;pattern cycle switch 
    SW2 var PORTA.0                     ;select music or clock
    mus var PORTA.2                     ;music input pin A2
    SWcount var byte                    ;used to count the button SW1 presses
    SWcount2 var byte
    swcount=1                           ;set default to pattern 1
    steps VAR BYTE                      ;used to store the number of steps in the pattern sequence
    counts VAR BYTE                     ;used in the FOR NEXT loop to run through the sequence
                                                                
    ;************* main program ****************
    counts = 0                          ;set the value of counts to the start of each pattern
    
    Main:
    Pot PORTA.1,scale,D                 ;used to read value from 10k pot
    if sw1=0 then swcount=swcount+1     ;check to see if up button pressed, if so add 1 to SWcount
    if sw2=0 then goto music
    pause 60                            ;debounce delay
    If swcount>7 then swcount=1         ;error trap for exceeding max patterns                          
    gosub sel1                          ;go to subroutine to select pattern based on Swcount value
    FOR counts = 1 TO steps             ;advance to through the entries
    gosub sel2                          ;go to subroutine to advance through sequence
    PAUSE D                             ;pause period set by varible D
    NEXT counts                         ;advance through loop to next position                    
    goto main:                          ;go back to the main program and run again
    
    
    music:
    if sw1=0 then swcount=swcount+1     ;cycles through the patterns by adding 1 to SWcount
    pause 60                            ;debounce delay
    If swcount>7 then swcount=1         ;error trap for exceeding max patterns                        
    gosub sel1                          ;go to subroutine to select pattern based on SWcount value
    If mus = 1 then counts = counts + 1 ;if bass or beat present move to the next step in pattern 
    gosub sel2                          ;go to subroutine to display pattern in current step
    If counts = steps then counts = 0   ;if counts then reset counts to 1
    goto music:                         ;go back to the start of the music section 
    
    ;************* Subroutines *****************
    Sel1:
    if swcount = 1 then read Patt1, steps   ;read the first value in data string patt1 and place it in steps
    if swcount = 2 then read Patt2, steps
    If swcount = 3 then read Patt3, steps
    if swcount = 4 then read Patt4, steps
    if swcount = 5 then read Patt5, steps
    If swcount = 6 then read Patt6, steps
    If swcount = 7 then Read patt7, steps
    return
    
    Sel2:
    if swcount = 1 then READ (Patt1+counts), PORTB  ;read the next value in patt1 and display it on PORTB
    if swcount = 2 then READ (Patt2+counts), PORTB
    if swcount = 3 then READ (Patt3+counts), PORTB
    if swcount = 4 then READ (Patt4+counts), PORTB
    if swcount = 5 then READ (Patt5+counts), PORTB
    if swcount = 6 then READ (Patt6+counts), PORTB
    if swcount = 7 then READ (Patt7+counts), PORTB
    RETURN
    And this is the warning that I get after it compiles

    Code:
    warning[202] (path and file name).mac48: Argument out of range. Least significant bit used
    Last edited by malc-c; - 9th December 2006 at 22:16.

Similar Threads

  1. PIC16F690 PBP boundary crossing warning message
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th May 2008, 11:17
  2. Micro Code Studio - Warning message
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2006, 21:17
  3. MicroCode Studio Boundary Warning Message
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th March 2006, 09:13
  4. Message String Table using Readcode
    By mytekcontrols in forum Code Examples
    Replies: 2
    Last Post: - 10th July 2005, 23:17
  5. warning message
    By pic beginner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd July 2004, 02:53

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