Connect with us

PIC MCU and LCD

Discussion in 'Microcontrollers, Programming and IoT' started by kievari, Sep 18, 2010.

Scroll to continue with content
  1. kievari

    kievari

    5
    0
    Aug 31, 2010
    Hi,

    Disclaimer:
    you are going to read a foolish, damn beginner, novice, ordinary question.

    The question starts from here:

    I've met a way of PIC MCU pin assignment which is new to me:
    Code:
    sbit CS=P2^5;		//Chip select
    The style I knew from before is like:
    Code:
    void main()
    {
    TRISB = 0; // Configure PORTB as output
    PORTB = 0xAA; // Turn on odd numbered port pins
    }
    
    Could anyone please explain how the initial method works?

    Also, in the codes I see:
    Code:
    #include "reg52.h"
    Does anyone knows about this file or could point me to an article about its usage? I guess that it is a way of defining/assigning ports of PIC, but I need something more than "guess" to work with :D
     
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,401
    2,777
    Jan 21, 2010
    reg52.h is a header file probably supplied with the compiler.
     
  3. Militoy

    Militoy

    180
    0
    Aug 24, 2010
    The sbit variable is a Keil bit definition, within the special function register (SFR). It needs to be declared outside of the function - so it looks different from your definitions declared within a function. You need to look at the Keil Cx51 user's guide for more info.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-