Maker Pro
Maker Pro

PIC MCU and LCD

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
 
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