Skip to content

Functions for working with Microchip's RTDM interface in julia

License

Notifications You must be signed in to change notification settings

cstook/MicrochipRTDM.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicrochipRTDM.jl

Build Status

MichrochipRTDM.jl is a bunch of functions usefull for working with Microchip'sTM RTDM interface in julia.

Installation

MicrochipRTDM.jl is currently unregistered. It can be installed using Pkg.clone.

Pkg.clone("https://github.com/cstook/MicrochipRTDM.jl.git")

The julia documentation section on installing unregistered packages provides more information.

Usage

Load the module.

using MicrochipRTDM

Create a dictionary of symbols from the .map file.

projectdirectory = "your_project_directory.x"
mapdict = microchip_parsemap(projectdirectory,"production")

The second parameter is either "production" or "debug". It will default to "production" if unspecified. You can pass the .map file instead of the project directory. In this case the second parameter is ignored.

The following assumes a serial port is opened as io. One way to do this is to use FTD2XX.jl.

Create an RTDMInterface object.

rtdminterface = RTDMInterface(mapdict,io)

The RTDM link can be verifyed.

isrtdmok(rtdminterface)

The memory of the microcontroller can be read and written with rtdm_read, rtdm_read!, and rtdm_write.

# read a single unsigned 16 bit integer
readvalue = rtdm_read(rtdminterface, UInt16, :your_symbol_name,retry = 3)

# read 128 unsigned 16 bit integers
bufffer = Array(UInt16,128)
rtdm_read!(rtdminterface, buffer, :your_symbol_name)

rtdm_write(rtdminterface, 0x1234, :your_symbol_name) # write 16 bit value
rtdm_write(rtdminterface, 0x12,   :your_symbol_name) # write 8 bit value)
rtdm_write(rtdminterface, buffer, :your_symbol_name) # write array
# need to increase default buffer size in microcontroller to write large arrays

# or just specify address as Integer
rtdm_write(rtdminterface, 0x1234, 0x00000100)

Close the interface.

close(rtdminterface)

About

Functions for working with Microchip's RTDM interface in julia

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published