Jump to content

Real Hardware Example For Dummies


Recommended Posts

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

Link to post
Share on other sites
  • 7 months later...

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

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...