Jump to content


Photo

Real Hardware Example For Dummies


1 reply to this topic

#1 Micmar

Micmar

    Newbrie

  • EstablishedMember
  • 13 posts

Posted 19 March 2012 - 10:44 AM

Hello

I have download, test, and buy the basic compiler.
The example work well and the simulation is very usefull.
But when I tried to start whith my first project I have some trouble on the port initializazion, register setting(clock, wd, etc.)
Can anyone publish in the forum a simple real example finished to fit in a micro?
The increment of the port example is well but not referred to an hardware.

Thanks in advance and sorry for my english, Marco

#2 hjlink

hjlink

    Newbrie

  • EstablishedMember
  • 6 posts
  • Gender:Male

Posted 31 October 2012 - 04:25 PM

Marco,

Below is a program I wrote for a 16F877A. All it does is flash an LED on PORT C. But I think it will have all of the basic info you need.



#include <basic/system.bas>

#pragma DATA _CONFIG, _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF
#pragma CLOCK_FREQ 4000000
#pragma OPTIMIZE "1"

dim PC as byte

sub ToggleLED()
PC = PC ^ 00000001b
portc = PC 'Flip the 1st LED
call delay_ms(500)
end sub


sub main()
'setup PIC
trisc = 0 'Set port c to all output

'main loop
do while 1
call ToggleLED()
loop
end sub



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users