Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - netcruze

Pages: [1] 2 3 4
1
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: January 13, 2014, 01:07:47 PM »
Hi, the old i2c1WriteSlaveRegBlock() functions doesn't exist any more. The new I2C library (nz_serI2C.c) is Asynchronous, and has replaced the old. Please only refer to the documentation in the V2.03 Beta you downloaded, and not the documentation online (for older V2.02). You can use the following code:
Code: [Select]
    i2c1WriteMessage(0x82, (BYTE*)"\x00\x9F\x09", 3);       //Write Byte 1=0, Byte2=0x9F, Byte3=0x09 to slave at 0x82
    if (i2c1GetStatusWait(0) != 0) {
        //ERROR! Could be that no I2C slave with given address is on bus (no I2C acknowledge received for transmission)
    }

2
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: January 06, 2014, 04:07:49 PM »
Hi, I have made a couple of changes to the current V2.03 beta. Please download latest version here:
www.netcruzer.com/nz/netcruzer_v203beta140107.zip

Do the same as last time, just replace the main.c file in download (..src/projects/webserver/main.c) of your project with main_I2C_Power_Demo.c I sent you last time.

I can not test the I2C related code, seeing that I do not have your hardware. You will have to do the testing from here on.

1) Are you using the "Netcruzer USB Terminal" to monitor debug output? You need this app to see if there are any errors on your web server. Download and install it on your PC, and connect your PC to the SBC66 board. For details, and download see click here.

2) All I2C data is read and stored in the "User Memory" in the processIO() function of the main.c file. You will have to debug this to confirm it is reading the correct registers of your I2C hardware. You can use DEBUG_PUT_XXX functions to print debug information to the "Netcruzer USB Terminal" to help you fault find. This is a GREAT help when debugging an app. For example, the print the contents of a register(myRegister for example), could use this code:
Code: [Select]
   DEBUG_PUT_STR(DEBUG_LEVEL_INFO, "\nRegister=");
   DEBUG_PUT_BYTE(DEBUG_LEVEL_INFO, myRegister);

3)
Quote
The main.c file controls the actual reading from my sensors and placing the data in memory - if I make changes to this file I will have to rebuild the firmware and re-upload it to see if it worked - correct?
Yes, this is correct.

4) The "power.xml" web page is the one that gets all the "User Memory" values, and makes them available on the web page. These are the values read by I2C in the processIO() function, and place in "User Memory".


===== Displaying power.htm web page process =====
The AJAX process used on the web pages work as follows. For this example, I will use the V1 voltage value displayed on the power.htm page:
  • In your web browser, you request the page "power.htm". This page calls the dataForPowerHtm() JavaScript function (located in main.js).
  • The "power.htm" page is loaded in your browser. All V and A values are blank for first couple of ms
  • While the page is loading, the dataForPowerHtm() function is also executed. This function loads the "power.xml" page in the background.
  • The "power.xml" page is requested from the SBC66 board. This page contains tags. For example, the V1 tag is "~#u00w~". This tag is replaced by the contents of "User Memory" location 0. For tag syntext, see www.netcruzer.com/project-webserver-tags. This is the location in "User Memory" where the processIO() function stored the data read from your I2C registers containing V1's value
  • Once the "power.xml" page has loaded, the dataForPowerHtm() function will replace all <span> elements in "power.htm" with the V and A values required in "power.xml". For V1, the following code in dataForPowerHtm() does this:
    $('#pwrV1').html(showVA(xmlcontents, 'pwrV1'));
    This will replace the following line in "power.htm" with the contents from "power.xml":
    <span id="pwrV1">.</span>
  • The previous step will replace all V and A values displayed on the "power.htm" page with the actual values received from the SBC66 in the "power.xml" file. This is repeated every 250ms.

If the data is in a different format, and needs processing before it gets displayed on your web page, you have to add this processing in JavaScript to the "main.js" file.

3
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: December 30, 2013, 05:38:34 PM »
Hi, I have finished the new firmware (beta stage). You need it for the new webpages to work. You can download it here:
www.netcruzer.com/nz/netcruzer_v203beta.zip

For your application, you will need to build the "SBC66EC Revision 2" firmware, and upload it to your SBC66EC boards:

===== Modifications the Firmware =====
You need to modify your main.c file so that it reads the required I2C registers to the "User Memory" locations displayed in your web page. I did this for you. Replace the main.c file of your project with the attached file. It will read all Voltage, Current and Temperature I2C registers every 250ms. They are copied to the "User Memory" locations mentioned in a previous post. These user memory locations are displays on your web page by using the "User Memory Tag" as described here. For example, the voltage for channel V2 is read via I2C and saved to "User Memory" address 0x02. To display this on your web page, simply use the tag "~#u02w~". This will be replaced by the webserver with the contents of "User Memory" address 0x02. Any additional processing you want to do with this variable should be done on your web page via JavaScript.

===== Displaying values on Webpages =====
Use the webpages I posted in previous post. They will display the Voltage, Current and Temperature values read via I2C and saved to the "User Memory".
The webpages are updated as described here.

4
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: December 13, 2013, 03:11:49 AM »
Hi, nearly all working. Implemented all the "User Memory Commands" and "User Memory Tags". From a web page you can now write to a reserved block of 256 bytes of "User Memory", and using tags can display the contents of this "User Memory" on the web page.

I created a page with 12 voltage (2 bytes each, user memory 0x00 to 0x16), 12 current (2 bytes each, user memory 0x20 to 0x36), and temperature (user memory 0x40). I attached a picture of this page. It uses AJAX, so all V, A and Temperature values are updated in the background, no page flicker. I also attached the zipped folder containing the web pages. If you look at the power.xml file, this is the file that is updated by AJAX. It contains all the tags for displaying the user memory locations. In the actual SBC66EC, the V,A and temperature values are written to these user memory locations. The XML file is:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<ourXMLdata>
  <!-- See http://www.netcruzer.com/project-webserver-tags for info on Tags-->
  <!-- Volage 1 to 12 uses User Memory Tag 0x00,0x02,...0x16 -->
<pwrV1>~#u00w~</pwrV1>
  <pwrV2>~#u02w~</pwrV2>
  <pwrV3>~#u04w~</pwrV3>
  <pwrV4>~#u06w~</pwrV4>
  <pwrV5>~#u08w~</pwrV5>
  <pwrV6>~#u0Aw~</pwrV6>
  <pwrV7>~#u0Cw~</pwrV7>
  <pwrV8>~#u0Ew~</pwrV8>
<pwrV9>~#u10w~</pwrV9>
  <pwrV10>~#u12w~</pwrV10>
  <pwrV11>~#u14w~</pwrV11>
  <pwrV12>~#u16w~</pwrV12>
  <!-- Current 1 to 12 uses User Memory Tag 0x20,0x02,...0x36 -->
<pwrA1>~#u20w~</pwrA1>
  <pwrA2>~#u22w~</pwrA2>
  <pwrA3>~#u24w~</pwrA3>
  <pwrA4>~#u26w~</pwrA4>
  <pwrA5>~#u28w~</pwrA5>
  <pwrA6>~#u2Aw~</pwrA6>
  <pwrA7>~#u2Cw~</pwrA7>
  <pwrA8>~#u2Ew~</pwrA8>
<pwrA9>~#u30w~</pwrA9>
  <pwrA10>~#u32w~</pwrA10>
  <pwrA11>~#u34w~</pwrA11>
  <pwrA12>~#u36w~</pwrA12>
  <!-- Temepetarure uses User Memory Tag 0x40 -->
<pwrTemp>~#u40w~</pwrTemp>
</ourXMLdata>

I am now busy with the SBC66EC firmware creating the code that will read from you I2C chips every 50ms and write the values to the "User Memory" registers. This is all that is left, and is nearly done. The bad news is that I am on leave the whole of next week! I really wanted to get a the current version of the SBC66EC firmware out, but just have not completed the new I2C code (interrupt routines the processes I2C in the background).

5
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: December 11, 2013, 11:03:58 AM »
I am trying to a pre-release SBC66EC/SBC66ECL Webserver version out today for testing.

6
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: December 11, 2013, 10:54:17 AM »
It is now online, and can be downloaded here:
www.netcruzer.com/redir/nzapps_download_curr

7
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: December 10, 2013, 02:57:10 PM »
Hi, I have been working very hard towards the next release that will make all this possible.

Needed to create a new version of the MPFS Web Page generator tool, seeing that the new release will support "Tags", which makes it very easy adding "Tags" to web pages to display custom data. In your case, the values read via I2C. The new version is done, and has been called "Modtronix Webpage Generator". It is available here:
www.netcruzer.com/webpagegen

In a previous post I suggested you use the "x", "y" and "z" user Tags. But, that would require you modify the firmware, and add them. I have now introduced new Tags for displaying the content of "User Memory". See the "u - User Memory Tags" section here:
www.netcruzer.com/project-webserver-tags

Using this method, you decide which address in user memory you want to assign to what variables. For you example, we can use a WORD for each variable (voltage, current, temperature):
- Voltage1 to Voltage12 use addresses 0x00 to 0x0B. Use tag "u00w" to "u0Aw" to display value on web page.
- Current1 to Current12 use addresses 0x10 to 0x1B. Use tag "u10w" to "u1Aw" to display value on web page.
- Temperature use addresses 0x20. Use tag "u20w" to display value on web page.

So, in the code we now only have to implement your custom I2C reading every 50ms. The read I2C results will be written the addresses given above in User Ram. I will:
- Put current version of Webserver on our site with these features
- Help you create the code for your I2C reading, that writes values to User Memory.


8
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: December 05, 2013, 05:00:04 PM »
AJAX is where the values on your web page are updated in the background, without reloading the whole web page.

All sounds good. Can I suggest for your suggested web page layout (you included in attached pdf file) that you add an "enable" check box on the same row as your Voltage and Current displays. Can also add functionality to web page that if disabled, the row is grayed out.

This way your web page will have 13 rows. The first 12 rows will be:
DC Output #?: Voltage(V) 0.00V   Current(A) 0.00A   Enable


The 13th row will be your temperature, and below that your submit (press to update enable/disable) button.

Can I add the web page to this forum if I create it for you? This way, it will also help others who want to create similar pages.

9
SBC66EC & SBC66ECL / Re: Ethernet to I2C converter
« on: December 04, 2013, 11:50:59 AM »
Hi, you document is very clear, and it shouldn't be too hard to do. It seems like most of the time you want to monitor Current and Voltage of the outputs, is this correct? The normal way to do this would be via AJAX. Your application will constantly read the V and A from your hardware, and the web page will display the current value. This means that you web page is not really triggering the I2C reads, but they are continuously done on the SBC66EC. Will this be an option, or are there too many values that will have to be continuously read? The new I2C code is implemented in the background via interrupts. So, if you run your I2C bus at low speed (100kbit/sec), you can read about 10 bytes per 1 ms. Say if you have a cycle of 50ms, you can read 500 bytes per 50ms on the SBC66EC. This should be enough to cover all your inputs.

I am very close to release the next version of the SBC66EC Webserver. It has LOTS of new features, including command and tag processing via HTTP GET and POST. This is used to easily control outputs, and monitor inputs via your web page.

I think it could work like this:

- SBC66 continuously reads V and A from all channels and stores it in a structure. If you use a 50ms cycle time, you can add a 50ms timer in your code that will read all power supply values each 50ms and store them in a structure on the SBC66EC. The I2C reads are done in the background, and do not take up lots of processing time.

- You add "tags" to your SBC66 code to display these V and A values. The x,y and z tags are reserved for the user. So, you could use the following tags for your power supply V and A for example: "xv12" for voltage of unit 12, and "xa12" for current of unit 12. To display the V and A on a web page, you would insert "~xv12~" in your *.htm page, and it will display the voltage of unit 12.

- You add "commands" to your SBC66 code to control you power supply. The x,y and z tags are reserved for the user. The new SBC66 code that is very close to release supports commands via GET and POST. So, if you want to add a command to enable channel 5, you could for example use the command "xe12". This is very simple to implement in code. The new code has a function called cmdExecNameValueCmd() in the cmd.c file. You simply add you command to this function, and make it do what you want. To add a button on your web page to turn off channel 5 for example, use this code:
Code: [Select]
<form method="GET" action="mypage.htm">
<button name="xe12" value="0">Turn Channel 5 Off</button>
</form>

- The new SBC66 code supports sending I2C messages via commands. You don't have to modify the SBC66 code. The "s7" command is used to send data to I2C port 1. For example, to send 3 bytes (0x90, 0x01 and 0x30 for example) to I2C port 1, following command can be used: "s5=900130". To do this via a button on your web page, simply add the following code to your web page:
Code: [Select]
<form method="GET" action="mypage.htm">
<button name="s5" value="900130">Send I2C message</button>
</form>





10
Netcruzer USB Bootloader - PC App / Re: Compiling HIBootloader
« on: December 03, 2013, 05:34:22 PM »
Hi, on what operating system are you trying to compile the project? I am using QT5.1.0, on 64-bit Windows 7. Have the 32-bit QT installed. The "building_projects.txt" file contained in the root folder of the zipped download contains the procedure.

From "building_projects.txt"
Quote
To modify and build the included projects, download and install QT 5.1.0 (higher should also work) from http://qt-project.org/downloads. Various downloads are available from this site. The "Netcruzer Apps" were built with the following download:
"Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)"

This download is for 32-bit Windows, and includes Qt 5.1.0 libraries, Qt Creator 2.7.2 and 32 bit MinGW (Compiler).

After launching Qt Creator, the "Netcruzer Apps" can be modified and compiled.
- Unzip the "Netcruzer Apps" to a folder on your computer
- Launch Qt Creator
- In <File> menu, select <Open File or Project>, and select the Qt Project file for the desired "Netcruzer App". For example, for the "USB HID Terminal", open
  "..\NetcruzerApps\source\USBHIDTerminal\USBHIDTerminal.pro"
- A "Configure Project" dialog will open in Qt Creator, with suggested folders. To use default suggested folders, click "Configure Project" button.
- That's is! You should now be able to build and run the project by selecting <run> in <build> menu.

For the HIDBootloader, you should open the following project:
"..\NetcruzerApps\source\HIDBootloader\HIDBootloader.pro"

After that, pressing "Ctrl+R" should build and run the project.

11
SBC66EC & SBC66ECL / Re: SBC65 vs SBC66
« on: November 22, 2013, 01:41:21 PM »
Hello, these commands are not implemented on the SBC66EC yet, but will soon be.

12
Will send you a message via email with requested details.

13
I will need a sample though. Could you order one from http://australia.rs-online.com or somewhere else in Australia, and have it shipped to me? Or give me the digikey part number, and I can order it with my next order.

14
OK, I will write a library that can be configured any two inputs, and provides some functions for determining if it was tired,  and in what direction. Do you have any sbc66 boards?

15
Webserver Firmware / Re: Missing _README.h and math.h
« on: November 05, 2013, 02:55:14 AM »
Hi,  these files are only for documentation,  and not part of the project. I will add them to the next release that is soon due.

Pages: [1] 2 3 4