1. arikiev

    Thread Starter New Member

    Sep 18, 2010

    you are going to read a foolish, <snip> 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 ( (Unknown Language)):
    1. sbit CS=P2^5;        //Chip select
    The style I knew from before is like:
    Code ( (Unknown Language)):
    1. void main()
    2. {
    3. TRISB = 0; // Configure PORTB as output
    4. PORTB = 0xAA; // Turn on odd numbered port pins
    5. }
    Could anyone please explain how the initial method works?

    Also, in the codes I see:
    Code ( (Unknown Language)):
    1. #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
    Last edited by a moderator: Sep 18, 2010
  2. debjit625

    Well-Known Member

    Apr 17, 2010
    You have mixed codes of two different chips.#include "reg52.h" is a header file which define all the SFR of 8052 its a mcu like PIC.Many company provide 8052 chips and one of them is Atmel search their AT range.And yes another thing the PIC C compiler is not going to compile code for 8052 you need something other like uVision IDE with C51 compiler.

    Good luck