Old BMS Software Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

feken
Posts: 13
Joined: Sun Nov 07, 2010 8:33 am

Re: Old BMS Software Thread

Postby feken » Mon Nov 22, 2010 2:45 pm

According to the melabs site the 2.60A version is the latest, which is the one i'm using, so that could not be it. Just to be sure i'll program your hex version into it tonight.

My schematic is very simple: basicly i'm powering the PIC and have a led on the load output, and connect my serial tx and rx to slaveIn and slaveOut.

When reading the code I would say that the slave forwards every command I send to it, so that shouldn't matter:

Code: Select all

SERIN2 SlaveBusIn, 16468, 5000, TimeOut, [Command]   'Receive Command Byte on Slave Data Bus   Timeout 5s
       
if Command = 1 then    
..
..

serout SlaveBusOut, T9600, [Command]     'Send Slave command at Baud9600 (SlaveBus) to next slave


Or am I missing something there? i'll check what i'm sending it tonight.

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Re: Old BMS Software Thread

Postby retepsnikrep » Mon Nov 22, 2010 4:20 pm

Francisco it's to fit into 16 bit variables.
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

feken
Posts: 13
Joined: Sun Nov 07, 2010 8:33 am

Re: Old BMS Software Thread

Postby feken » Mon Nov 22, 2010 7:44 pm

I'm on to something..

If I use the hex file the PIC behaves differently... the light comes on quiker when upping the voltage, and it sends out zero's over the serial port. To get my version to compile I have to remove the @ DEVICE lines..

Could that have something to do with it? I guess i'm using the wrong assembler.

Peter do you use the PM assembler of the MPASM ?

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Old BMS Software Thread

Postby GregsGarage » Mon Nov 22, 2010 8:16 pm

Hi feken,

What value do you have for R4 on the slave board? The schematic shows 10k, but try a 1k instead. Otherwise you may need to get an osilliscope to check the serial comms waveforms. Also make sure both are set for the same baud rate, if I recall the slaves are set for 9600 by default.

EDIT: The slaves use the PM assembler.
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

feken
Posts: 13
Joined: Sun Nov 07, 2010 8:33 am

Re: Old BMS Software Thread

Postby feken » Mon Nov 22, 2010 8:33 pm

Hmmm.. can't get the PM assembler to work on my 64bits system, guess that's not supported.
Will de slaves not work with the MPASM assembler?

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Old BMS Software Thread

Postby GregsGarage » Mon Nov 22, 2010 9:35 pm

You will have to use MPASM then, but as you have found the @ DEVICE needs to be commented out. This sets the configuration bits for the pic. So 2 choices. First is to set the configuration bits using MPASM, which will require a bit of work. Second and quicker solution is to set the configuration bits before programming the slave. To get the correct value, load our hex into your programmer and you can then see the configuration value. Write this down and then use it for any changes you make to the code, that is load your new code into the programmer, adjust the configuration bits to the correct value (pbp will use a default value if none is specified) and then program.

Once you have it working then figure out the correct MPASM settings so it does it automatically and post your changes here so we can add it to the code. :D For the master and watchdog we have had to change to MPASM, but the slave code hasn't seen any changes that requires MPASM, but it would be nice to use the same assembler for all the chips.
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Re: Old BMS Software Thread

Postby retepsnikrep » Tue Nov 23, 2010 1:43 am

I think I did change to masm for all the chips a while back. Check the latest version in this thread a few posts back now. It should say in the comments in first few lines. Greg is right about the 1k resistor.

Edit looks like I never have posted the mpasm slave code :shock: Here is Slave V08 I found on my travel PC dated 11/10/10 so could be the latest version. I'm away on hols at the moment not back until 03/12.
Attachments
SLAVE_V08_111010_MPASM.zip
(5.95 KiB) Downloaded 240 times
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

feken
Posts: 13
Joined: Sun Nov 07, 2010 8:33 am

Re: Old BMS Software Thread

Postby feken » Tue Nov 23, 2010 6:38 am

Peter,

Thanks.. I also tried this based on documentation but didn't get it to compile.
With your MPASM version I still get a compile error:

Code: Select all

ERROR: Unable to execute mpasmwin.Error[118]   C:\PBP\SAMPLES\BLINK.ASM 178 : Overwriting previous address contents (2007)


If I comment out the __config line, it does compile.

Think i will have to find a 32 bit installation and use PM.EXE

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Old BMS Software Thread

Postby GregsGarage » Tue Nov 23, 2010 9:39 am

The problem is you have 2 __config lines and are only allowed one. The second __config line is a default configuration setup in pbp. You need to comment it out for it to compile correctly with your __config line. I can't remeber exactly where it is, but it is in your pbp folder. Have a look through some older posts in this thread for info, shouldn't be more than a couple of pages back.
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

feken
Posts: 13
Joined: Sun Nov 07, 2010 8:33 am

Re: Old BMS Software Thread

Postby feken » Tue Nov 23, 2010 12:45 pm

Greg,

You must be referring to this:
So if you are going to compile from the source code you need to comment out the __config line in your pbp 12F683.INC file.


Will try this when I get home, thanks.


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 4 guests