I2C Communication from 18F4PIC550 to Titan Intel BLDC Motor Driver


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2012
    Posts
    3

    Default I2C Communication from 18F4PIC550 to Titan Intel BLDC Motor Driver

    Hi,

    Quick note to apologise for if I miss any information out from this initial post, if you ask for any more information i'll post it as soon as I can. I have hunted the forums on this and every other site to find a answer but to no avail.

    Objective
    Read PelcoP control command from a serial port and output the correct I2C control commands to the Titan Intelligent BLDC Motor along the SDA line asynchronously. This must be completed using Pic Basic Pro.

    Progress
    I started from the working C code that was given to me by the previous person assigned to the project. This C code works absolutely fine and reads the commands in and write the I2C commands out perfectly (although the code is badly written). The code can be seen here.
    I slowly worked through using PicBasic with the PIC18F4550 to get it to flash the on-PCB led to test my programmer and code works correctly, which it does and then moved on to try to create a simple program that writes the I2C commands straight from code to the motor driver. This is where I got stuck and have remained stuck for a number of days. I need you help to get this program writing the commands to the motor dirver to get it to move.

    Resources
    Original C Code: Ccode.txt (Apologies about the write up, you will need to copy and paste it into a editor like notepad++ and set language to C)
    Titan BLDC Motor I2C Protocol
    PIC18F4550 Datasheet
    The PicBasic code I am trying to get to work: blink.bas

    Relevant Information
    • The SDA line is connected to PORTB.0
    • The SCL line is connected to PORTB.1
    • The clock used is the 8MHz internal clock set by OSCCON = 110010
    • I can see the output from the PIC trying to write to the camera but the camera remains stationary. It seems the output is working but the motor driver is not reading the data in.
    • The SDA output from the C code and the PBP code seem to be the same.
    • The SCL line on both programs remains high throughout the code process.
    • The configuration bits set in the PBP file is there to make it match the C code config bits.
    Thanks for your help, replies e.t.c.
    Last edited by JJVector; - 7th August 2012 at 10:14.

  2. #2
    Join Date
    Aug 2012
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Re: I2C Communication from 18F4PIC550 to Titan Intel BLDC Motor Driver

    Quote Originally Posted by JJVector View Post
    [*]The clock used is the 8MHz internal clock set by OSCCON = 110010
    Edit: OSCCON = %01110010

  3. #3
    Join Date
    Aug 2012
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Re: I2C Communication from 18F4PIC550 to Titan Intel BLDC Motor Driver

    Code:
    PanRightNormal:
    	PORTB = $1C 	'STX Set Ports Low
    	addr = $00		'Set address to write to to default (0)
    	a[0] = $07
    	a[1] = $00
    	a[2] = $00
    	'gosub flashled 'Flash debug LED on PortE
    	pause 10		'Pause 10ms between commands to allow them to go through
        I2CWRITE sda,scl,cont,[STR a\3]	'Write 0101|000|0 to initialise I2C comms (controlbyte|address|read/write)	
    	'LSB of velocity byte
    	'gosub flashled	'Flash debug LED to show commandds ave been completed
    	pause 10		'Pause 0.01 second
        return
    Using a array fixed my problem, i was continually sending the control byte when did it separately.

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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