Micmar 0 Posted March 19, 2012 Report Share Posted March 19, 2012 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 Quote Link to post Share on other sites
hjlink 0 Posted October 31, 2012 Report Share Posted October 31, 2012 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.