Exploring Pic16F628a...


Results 1 to 12 of 12

Threaded View

  1. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mbox View Post
    Hello everyone,
    I'm trying to turn On Led1,Led2,Led3 with the Hyperterminal, using pic16F628a. I have this initial code that simply blinks 3 leds. Please guide me on how to configure the bits that enable RX in Rb1 using 4 Mhz internal clock. Please check my initial code below...
    <font color = red>[codes]</font color>
    Define OSC 4
    CMCON = 7 ' PortA = digital I/O<font color=red> not quite, it means Comparators off.</font color>
    VRCON = 0 ' A/D Voltage reference disabled
    <font color=blue>"lets add this so PortA does not act like a radio antenna and create Ghost problems
    PortA=0
    TRISA=0
    </FONT COLOR>
    TRISB = %11110000 '<font color=green>ports7:4 inputs, ports 3:0, outputs, is that what you want? </font color>

    PortB = %00000000 ' Turn pins to low state<font color=red> Put this before TRISB so when PortB becomes all outputs they initialize in a state set by you, instead of chance</font color>
    Led1 var byte ' Led1 as a byte(8 bits) variable
    myvar var word ' myvar as a word(16 bits) variable

    begin:
    high PortB.0
    pause 100
    low PortB.0
    pause 100
    high PortB.1
    pause 100
    low PortB.1
    pause 100
    high PortB.2
    pause 100
    low PortB.2
    pause 100
    goto begin
    <font color = red>[\codes]</font color>
    Should be CODE not CODES
    <br>
    <b> OH BY THE WAY, Congratulations, you have just written your first successful LED chaser, project using PBP and internal OSC, it works very nicely here.
    Last edited by Archangel; - 14th October 2008 at 02:28.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 23:14
  2. Do I need a pause?
    By tazntex in forum Serial
    Replies: 21
    Last Post: - 29th August 2008, 05:32
  3. Help Pic16f628a
    By gadelhas in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th August 2008, 00:22
  4. Changing bits in a byte for multiple output
    By tazntex in forum Serial
    Replies: 3
    Last Post: - 11th August 2008, 20:10
  5. Replies: 8
    Last Post: - 22nd July 2008, 21:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts