dummies guide to serin/serout by a dummie


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default schematic and codes...

    Hi!
    Just a begginer to pic programming, I have a pic16F628A and I'm trying to find a code & schematic for this mcu to use the internal clock and recieve data from hyperterminal that will lit Led1,Led2 and Led3. Hope you can help and thanks in advance....


    regards,
    mbox

  2. #2
    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
    Hi!
    Just a begginer to pic programming, I have a pic16F628A and I'm trying to find a code & schematic for this mcu to use the internal clock and recieve data from hyperterminal that will lit Led1,Led2 and Led3. Hope you can help and thanks in advance....


    regards,
    mbox
    Welcome to the forum !
    Here is the deal, offered to all newbies. Write some code and we will help you make it work. Some here may do handovers, most do not, but most are willing to share their experience and knowledge. Why no handouts, because you learn very little from them, whereas if you struggle, you learn, and before long you are helping others. So that said let's get busy with some code.<br> So for starters do this, write a program to turn on those LEDs either by changing a port status or just make a loop to flash them in sequence, it doesn't have to be pretty, or even work, but it should show you made an effort to.
    Last edited by Archangel; - 9th October 2008 at 08:21.
    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.

  3. #3
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Smile

    hi!
    thanks for the reply.. I have this simple code that will lit the LED1,LED2 and LED3...using Pic16F682A. But I Want to control them to hyperterminal. Can you show me how to enable the RX on RB1?
    [codes]
    CMCON = 7 ' PortA = digital I/O
    VRCON = 0 ' A/D Voltage reference disabled
    TRISB = %11110000

    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
    [/codes]
    Last edited by mbox; - 9th October 2008 at 17:21.

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You cannot connect pic directly to the PC Rs232 port! You will need a maxim 232 as an interface.

    Read the manual where you will find some example of Tx and Rx.

    When You have setup your hardware, than remember you will send bytes via RS232 so your pic will need to decode the bytes sent via hyperterminal and act upon it. For instance I can set all 8 ports B to ON sending via RS232 "255" or set them all to OFF sending a "0".

    Hope it will help you

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    You cannot connect pic directly to the PC Rs232 port! You will need a maxim 232 as an interface.
    Correct only if you are using the hardware serial from the PIC.
    If you plan to use SERIN or SERIN2 then all you have to do is use inverted mode.
    It is all in the manual
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    That's a start . . . .
    now add a byte variable and a word variable, give them names meaningful to you, like LED1 or OUTPUTLED1 or MBOXVAR1, right now they will just be there, not doing anything, and compile to check for errors.
    edit: Set your port latch before the Tris register, that way when the tris turns the port to outputs, they will be set at the desired state, next we will work on config statements.
    Last edited by Archangel; - 9th October 2008 at 20:24.
    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.

  7. #7
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Smile

    Good morning!!!
    This is my update code, adding 2 variables, when complied it says 85 words used.


    [codes]
    CMCON = 7 ' PortA = digital I/O
    VRCON = 0 ' A/D Voltage reference disabled
    TRISB = %11110000

    PortB = %00000000 ' Turn pins to low state
    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
    [\codes]

    thanks for the guidance,

Similar Threads

  1. USB HID Joystick for Dummies
    By Squibcakes in forum USB
    Replies: 21
    Last Post: - 2nd May 2014, 08:52

Members who have read this thread : 1

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