serial comm problem


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    For development i always use an LED to make sure my output is going on and off. Then I usually have to drive the relay with a transistor. I haven't found a relay yet I could directly drive.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    forget me...i was wrong
    Last edited by mister_e; - 27th June 2006 at 16:50.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    dumb answer here too check the next...
    Last edited by mister_e; - 27th June 2006 at 16:49.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    no big solution... it's working here using
    Code:
    Private Sub Form_Load()
        Option1(0).Value = True
        MSComm1.CommPort = 1
        MSComm1.Settings = "2400,n,8,1"
        MSComm1.DTREnable = False
        MSComm1.RThreshold = 1
        MSComm1.InputLen = 1
        MSComm1.PortOpen = True
    End Sub
    Private Sub Command1_Click()
        Dim pinstate As Byte
        If Option1(0).Value = True Then
            pinstate = 1
            Else
                pinstate = 0
            End If
        
        MSComm1.Output = Chr(255) & Chr(pinstate)
    End Sub
    
    Private Sub form_unload(Cancel As Integer)
        MSComm1.PortOpen = False
    End Sub
    on the PICSide
    Code:
    INCLUDE "modedefs.bas"
    
    Si       VAR PORTA.4
    RELAY    VAR PORTB.2
    pinstate VAR BYTE
    
    main:
        SerIn Si,n2400,[255],pinstate
        
        IF pinstate=1 Then
            GoSub Relayon
            Else
               GoSub Relayoff
            EndIF
        
        goto main
        
    Relayon:
        High RELAY
        Return
    
    Relayoff:
        Low RELAY
        Return
    sorry, try a lower resistor value and be sure you share the same ground, be sure you place 0.1 uF cap close to your PIC and be sure of your crystal speed and capacitor value.

    Schu4647 have also point an interesting fact... be sure it's not the relay who create the bug.
    Last edited by mister_e; - 27th June 2006 at 16:54.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    > I haven't found a relay yet I could directly drive

    There are many 5v Reed Relays, many of which need less current than an LED... and some even have integral back-emf diodes across the coil which dispenses the need for any other external components. Meder Electronic www.meder.com springs to mind, at prices in volume of under $1 a lump, they're not exactly budget breaking either.

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie
    > I haven't found a relay yet I could directly drive

    There are many 5v Reed Relays, many of which need less current than an LED... at prices in volume of under $1 a lump, they're not exactly budget breaking either.
    And they tend to be rated for billions of cycles.

  7. #7
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    Those are girly relays. I use manly relays.

Similar Threads

  1. Problem using Microloader and Uart Comm at the same time
    By guanerrr in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd August 2007, 10:31
  2. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 03:21
  3. Serial Communication Problem
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 23rd February 2006, 03:11
  4. Replies: 8
    Last Post: - 11th November 2004, 21:08
  5. 16F877, DS18S20 and Serial Comm Problem
    By YellowTang in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2004, 11:36

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