Hardware manual

55
6.4. Work with hi_cpu2 board.
During getting experience with PXMC library I got one of the tasks to make hi_cpu2 board
working with brushless motors. This board has H8S/2638 microcontroller, which was described
in 3
rd
section. Thanks that it should be very easy to port most of the code to the robot, which
later was designed for Eurobot 2007 competition.
Fig. 6.4-1. Hi_cpu2 board.
The whole source code of driver which I wrote consists from two files:
bldctest.h
bldctest.c
The bldctest.h is just a header file in which are predefinitions for all functions accessible from
outside of the library. Additionally we can find here definition of CPU frequency in kilohertz:
PXMC_CYCLEKHZ and the maximum of power (pxms_ene): PXMC_PWM_PER.
The second file, bldctest.c, contains implementation of several functions listed in below table
and additionally it also initializes the pxms_state structure and array which keeps the hall sensor
table.
The implementation of hall sensor array is presented below. The table consists from 8 fields
from 0 to 7. The numbers in the brackets represent the values which can be read from hall
sensor. The numbers after the equality sign state in which 60 degree part is the motor. All values
presented here are taken from figure nr 3.5-4, except of 0xff. These represent the states which
are unachievable by the motor and if such value occurs on hall sensor, then there should be
generated error state.