Saturday, April 21, 2007

PC based high frequency LED display

Its the project,we did for our Excel 2K7 and won the 1ST prize .
It consists of row decoder and column decoder with an 8-bit counter .
remember that all decoders are active low and for the current sinking process
one of the decoders must be inverted to give it to the led display array,ie (32X8)
The serial data is given to the 3to8-bit decoder enable input ,to blink
the corresponding led to blink.A computer programme to send the high bits of the
character map to the parallel port & the process is done so fastly which produces
illusion of character on the display board.
its all about the working of the led display
-The main advantage is ,less power consumption .
-secondly only one out put from parallel port .
-by changing the programme we can display any thing .
-can display any font .
the programming part is done by Mr: Arun Prabhakar (

Monday, April 16, 2007

Simple Counting Program

b1 var byte           'declares the variable b1 as type byte
poke TRISB, 0          'defines the all pins on the portB as output pins
let b1=0
loop:          'its an identifier for iteration
pause 1000          'it pauses the programm execution for 1 second
poke portB,b1          'writes the value of b1 on portB(decimal<=>binary)
b1=b1+1          'updetes the variable value to the nxt value
goto loop          'substitution for the loop statement,a simple goto
The connection diagram is as shown

Saturday, April 14, 2007

The programmer and the burner

The programmer details are available here
The programmer is a multi pic pragrammer .
we tried it and are happy to use that because the actual pic pragrammer costs
about 2000 Rs.But this programmer costs only less than 200Rs.
The ic burner software we have used is the

Friday, April 13, 2007

The compiler

The compiler for the pic basic pro or picbasic is free with some limitations
Its free version is available Microcode studio
The microcode studio contains the compiler and its free version is enough for ur use.


Named constants may be created in a similar manner to variables. It can be more convenient to use a constant name instead of a constant number. If the number needs to be changed, it may be changed in only one place in the program; where the constant is defined. Variable data cannot be stored in a constant.


mice CON 3


Variables are where temporary data is stored in a PicBasic Pro program. They are created using the VAR keyword. Variables may be bits, bytes or words. Space for each variable is automatically allocated in the microcontrollers RAM by PBP. The format for creating a variable is as follows:

Label VAR Size{.Modifiers}

Label is any identifier, excluding keywords, as described above. Size is BIT, BYTE or WORD. Optional Modifiers add additional control over how the variable is created. Some examples of creating variable are:

dog VAR byte
cat VAR bit
w0 VAR word

Thursday, April 12, 2007

Branch command

Branch offset, (label0,label1...)
Uses offset(byte variable)to index the list of labels.
execution continues at the indexed label according to
the offset value.
Branch B8, (label0,label1,label3)

if B8=0,then the program execution jumps to label0
if B8=1,then the program execution jumps to label1
and if B8=2,then the program execution jumps to label2

Goto statement:

Goto label
program execution jumps to statements begining at label.
Goto loop 'program execution jumps to the statements following the label loop
. 'statements


Let assigns a value to a variable.
The value assigned may be
1.A constant(Let B1=0)
2.The value of another variable(Let B2=B1)
3.The result of any math operations
(The operations are performed strictly
left to right and all operations are performed
with 16-bit precision
Let var=value

Pause command

This command provides a pause in program execution for
the period in milliseconds.Period is a 16 bit number
that can hold a maximum value of 65,535.
In milliseconds,that works out to just over one minute.
(60,000ms).Unlike the other delay functions ,Nap and Sleep,
the pause command doesn't put the microcontroller into a
low power mode.This has both an advantage and a disadvantage.
The disadvantage is that pause consumes more power :
The advantage is that the clock is more accurate
pause 250 'Delay for .25 seconds
The pause finds application in some situations where some
signals at the output or input pins may remain unchanged.
For example A typical gearbox motor will respond only after
30ms,after the appliction of valtage to it.

Wednesday, April 11, 2007

If .. Then statement

If coparisonstatement Then Label
This is similar to the if statement in C language
The Then in if..Then is essentially a Goto.Another
statement cannot be placed after the Then .What
follows must be a label.The command copares variables
to constants or to other variables.If only one variable
is used in comparison then it must be placed on left.
All coparisons are unsigned.

The peek command

We can use the peek command to check the status
of any input line.Using the peek command we can
read the five i/o lines of portA or the eight i/o
lines of portB at once.
peek address, var
As its name implies,the peek command allows to
view or peek at the contents of the specified
memory address.Typically the memory address
peeked at is one of the pic microcontroller's
registers.The peeked value is stored in a
variable var defined in the command.
The peek command can read an entire byte at
once as in thecase of portB ,but in the case of
portA only lower 5 bits of the peeked value are
The first 2 bytes of ram memory,B0 and B1 are
special.This is because we can test the bit
values contained in each byte.
For B0,Bit0 to Bit7
B1,Bit8 to Bit15
Using these we can check the condition
of the input bits or pins at the port.

Tuesday, April 10, 2007

Some things to be noted while writing picbasic programs

Identifiers are names used for line labels and symbols.
An identifier may be any sequence of letters ,digits,and
underscores,but it must not start with a digit.
Identifiers may be any number of characters in length :
however,the compiler will recognize only first 32
characters .Identifiers are not case sensitive hence
the labels LOOP:loop:Loop,etc will be read equivalently.
Line labels:
Labels are anchor points in our program.They are identifiers
followed by a colon.
Symbols make our program more readable.They use identifiers
to represent the constants,variables or other quantities.
Symbols cannot be used for line labels
symbol five = 5 'symbolic constant
symbol number = W2 'named word variable

Monday, April 9, 2007

High & Low commands in pic basic

We can output any bit at the ports randomly by using the High & Low
commands.These commands are limited to the portB .So the poke command
is necessary to output the bits at the portA.
Example :
High 0 'makes the output 1 at 0th pin of portB
Low command
Low command makes the output at the specified pin low .
Low 1 'makes the output 0at 1st pin of portB

PIC 16f84A RAM

Ram may be accessed as bytes (8bit numbers ) or words(16bit numbers).
pic basic has predefined a number of variables for us .Byte sized
variables are named B0,B1...B51 & the word sized ram BY W0,W1..W25.
The byte and the word variables use the same memory space and
overlap one another.


Comments are includeed by inserting a ' symbol(single quotation mark)
Comments are stripped in the hex file hence we can write any number
of comments in our program.

Sunday, April 8, 2007

The poke command

Once the lines have been configured (input or output )using
TRIS register ,we can start using port.To output a binary
number at the port,simply write the number using the poke
command.The binary equivalent of the decimal number will
be written to the port.
For example :
Poke 6, 0
will write 00000000 to the portB
poke 6, 255
will write 11111111 to the portB
Where 6 is the address of the portB
In a similar fasion we can output any decimal number between
0 and 256 (excluding 256) to the portB.

BASIC Language for PIC 16f84A programming

We can use basic or C language for the pic programming ,as
it is easy and simple to understand.The programs written in
assembly language for pic are complex and are not easy to
understand .Its future reference is difficult even thoughits
efficiency is high.
We did the pic programming,using the pic basic.

  • Some things to be noted while writing picbasic pr...

  • High & Low commands in pic basic

  • PIC 16f84A RAM

  • comments

  • The poke command

  • PIC 16F84A registers & ports
  • Friday, April 6, 2007

    PIC 16F84A registers & ports

    The pic 16f84Acontains 2 i/o ports ,port A& port B.
    Each port has two registres associated with it ,the
    TRIS(tri state )register and the address itself.
    The TRIS register controlls whether a particular
    pin on a port is configured as an input line or an
    output line .once the ports are configured the user
    may then read or write information to the port using
    the port register address.In 16f84A there are 8 pins
    available for port B & 5 for port A.
    LOCATION(hex) LOCATION(decimal)
    PORT A -----05h------------- 5
    PORT B -----06h -------------6
    TRISA -------85h -----------133
    TRISB -------86h------------ 134

    Thursday, April 5, 2007

    PIC 16F84A microcontroller architecture

    Pic micro controllers use haward architecture ,which
    uses seperate data and program memory .Also it uses seperate
    buses to communicate with each memory type .The haward
    architecture has an improved bandwidth over the von neumann
    architecture which uses same bus for the data and instruction.
    The data memmory can be further broken down into general
    purpose ragisters and special purpose registers.
    The registers in the Pic 16f84A are mapped at specific addresses
    in the data memory section.The picbasic language allows us to
    read & write to these registers as if they are std: mem:bytes.
    we read and write to these registers using the peek and poke
    commands in the pic basic language .
    we had used the Pic basic pro for the compilation & succeeded.
    Anyway the basic language made the programming task simple!

    PIC 16F84A microcontroller

    PIC 16F84A microcontroller(MC)
    General features :
    Risc cpu 35 single instructions
    operating speed DC-10MHz clockinput
    1k program Memory
    14 bit wide instructions ,
    8bit wide data path,
    direct &indirect &relative addressing:
    1000erase/write cycles:

    Peripheral features :
    13 i/o pins with individual direction control :
    high current sink/source for direct LED drive (25 mA sink max.per pin
    20mA source max .per pin ):
    TMRO-8-bit timer /counter with 8-bit programmable prescaler

    The 16f84A MC is a verstile MC with Flash memory (1K x 14bit )
    on board can endure a minimum of 1000 erase/write cycles .
    The program retension time B/w erase/write cycles is approximately
    40 years .
    The 18 pin chip devotes 13-pins to i/o .the pin status
    (I/O direction controll )can be done through programming .

    Can be programmed using assembly language or high level language .
    In the case of high level language such as BASIC we need a copiler
    to convert the programme to the hex file which can be directly
    programmed in to the PIC using a PIC programmer which is commonly
    available in the market.But the programmer will be costly for us
    (it costs nearly 3000Rs).So the best thing is to make one programmer
    as per the ckt diagram given in the site .we tried it & succeeded in
    it to programme the 16f84A.It is also used to program other pics.
    In the case of assembly language programming we need one assembler
    to conver it to the Hex file.
    We tried first with the BASic language and found it is the best to
    programme than the assembly language ,being less prone to error &
    easy to understand .We used the pic basic pro for compilation.