18F4550 - Does strange things on D ports


Results 1 to 8 of 8

Threaded View

  1. #1

    Default 18F4550 - Does strange things on D ports

    I have the following code written.

    When the debug code is send, the D6 & D7 port will also become HIGH.
    Why is this happening?

    code:

    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 20-10-2009                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    Include     "modedefs.bas"
    
    Define  OSC             20
    
    DEFINE  DEBUG_REG       PORTB
    DEFINE  DEBUG_BIT       6
    DEFINE  DEBUG_BAUD      9600
    DEFINE  DEBUG_MODE      1
    
    
    DEFINE  LCD_DREG        PORTB
    DEFINE  LCD_RSREG       PORTC
    DEFINE  LCD_RSBIT       6
    DEFINE  LCD_EREG        PORTC
    DEFINE  LCD_EBIT        7
    DEFINE  LCD_BITS        4
    DEFINE  LCD_LINES       2
    DEFINE  LCD_COMMANDUS   2000
    
    
    RS232_In VAR         PORTB.5
    
    StatusLED   VAR         PORTB.7
    
    
    DigiData            VAR     BYTE[74]
    
    x var byte
    i VAR Byte
    
    
    adcon1 = $0F
    
    
    Init:
    
        debug "Startup Alarm systeem V1.01",13,10
        
        Lcdout $FE, $01, "Rekavo"
        Lcdout $FE, $C0, "Bericht systeem" 
        
        PAUSE 500
        
        FOR x = 0 to 4
            High Statusled
            PAUSE 500
            LOW Statusled
            PAUSE 500
        NEXT x
             
    Goto Main
    
    Main:
    
        SERIN RS232_In,N9600,10,Main,DigiData[0]
        
        for i = 1 to 74
         SERIN RS232_In,N9600,1,Main,DigiData[i]
        next i
        
        For i = 0 to 74
            DEBUG DigiData[i]
        NEXT i
    
        DEBUG 13,10
      
        IF (DigiData[0] = $02) AND (DigiData[74] = $03) Then
            Debug "Juiste string ontvangen",13,10  
      
            Lcdout $FE, $01, DigiData[4],DigiData[5],DigiData[6],DigiData[7],DigiData[8],DigiData[9],DigiData[10],DigiData[11],DigiData[12],DigiData[13],DigiData[14],DigiData[15],DigiData[16],DigiData[17],DigiData[18],DigiData[19]
            Lcdout $FE, $C0, "Tijd: ", DigiData[70],DigiData[71],":",DigiData[72],DigiData[73]  
            
            PAUSE 2000
            
            Lcdout $FE, $01, " "
            Lcdout $FE, $C0, " "
                                            
        ELSE
        
            Debug "Onjuiste string ontvangen",13,10
       
        endif
    
    Goto Main
    
    end
    See the attachment for the configuration bits:
    Attached Images Attached Images  

Similar Threads

  1. Replies: 4
    Last Post: - 17th April 2009, 08:56
  2. Replies: 1
    Last Post: - 29th September 2007, 18:05
  3. 18F4550 to 18F2550
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th September 2007, 23:13
  4. USB Programmer for 18F4550 PICs
    By Kamikaze47 in forum USB
    Replies: 8
    Last Post: - 21st August 2007, 16:29
  5. How many serial ports can 1 PIC handle?
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd March 2005, 04:34

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