Maker Pro
Maker Pro

PIC MCU and LCD

kievari

Aug 31, 2010
5
Joined
Aug 31, 2010
Messages
5
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
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
reg52.h is a header file probably supplied with the compiler.
 

Militoy

Aug 24, 2010
180
Joined
Aug 24, 2010
Messages
180
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.
 
Top