Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

scottwday

Members
  • Joined

  • Last visited

Everything posted by scottwday

  1. Here are the commands in hex: POP00: 50 4f 50 30 30 c2 48 0d POP02: 50 4f 50 30 32 e2 0b 0d QPIGS: 51 50 49 47 53 b7 a9 0d QPIRI: 51 50 49 52 49 f8 54 0d This example program works with my inverter: https://github.com/scottwday/AxpertTest/blob/master/Program.cs
  2. https://github.com/scottwday/AxpertTest
  3. The line will always end with a CR character. There will never be a CR in the CRC, so as soon as you get a 0x0d you know you've got the entire response. static void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { var sp = sender as SerialPort; if ((sp != null) && (!_gotResponse)) { //Read chars until we hit a CR character while (sp.BytesToRead > 0) { byte b = (byte)sp.ReadByte(); _rxBuffer.WriteByte(; if (b == 0x0d) { _gotResponse = true; break; } } } }
  4. Sorry Jdp, I'm also stumped
  5. Can you post your code?
  6. Are you sure the baud and parity are set correctly in your VB app? It should be 2400 baud, no parity, 8 data bits, 1 stop bit
  7. You have sp.Open commented out as well. I've put a simple C# command line utility on my github which lets you send a command and prints out the response. It handles all the CRC stuff. It might also be useful for anyone wanting to use it from scripts etc. Eg: console>AxpertTest -p COM3 QPI(PI30console>AxpertTest -p COM3 QPIGS(244.2 49.9 244.2 49.9 0024 0015 000 435 54.00 001 100 0019 0000 000.0 00.00 00000 00010101 00 00 00000 110 You can also set the baud (- and the timeout in milliseconds (-t) Here'e the .exe binary https://drive.google.com/file/d/0B8CTDo4cVxUlYzFZWnYtYlVETFE/view?usp=sharing Here's the sourcecode https://github.com/scottwday/AxpertTest/blob/master/Program.cs I've tested it works on my inverter (~2014 model) and with my emulator
  8. I haven't tested your code, but at first glance it should be 2400 baud
  9. The inverter will only reply once it receives a CR (0x0d) character. The last argument to SerialPort.Write is the number of bytes to write. you're always going to need to write more than 2 bytes. In fact it's always going to be 3 more bytes than the command you want to send: The format is <command><CRC_MSB><CRC_LSB><CR> public byte[] GetBytes(string Command, ushort Crc){ byte[] result = new byte[Command.Length + 3]; Encoding.ASCII.GetBytes(Command, 0, Command.Length, result, 0); result[result.Length - 3] = (byte)((Crc >> 8) & 0xFF); result[result.Length - 2] = (byte)((Crc >> 0) & 0xFF); result[result.Length - 1] = 0x0d; return result;} This code packs the bytes to send. First it's the bytes from a string, then 2 bytes of the 16 bit CRC, then a CR character. If you look at the CRC code it makes sure that it never uses 0x0d or 0x0a because they are characters that denote the end of the command.
  10. I fed my C# CRC code through an automatic code converter... Who knows, maybe it'll work Imports System.Collections.GenericImports System.LinqImports System.TextImports System.Threading.TasksNamespace InverterEmulator ''' <summary> ''' Calculates the CRC for the inverter ''' </summary> Public Class CRC16 ''' <summary> ''' Ported from crc.c: http://forums.aeva.asn.au/forums/pip4048ms-inverter_topic4332_page2.html ''' </summary> Public Shared Function Calculate(pin As Byte()) As UShort Dim crc As UShort Dim da As Byte 'INT8U far *ptr; Dim ptr As Byte Dim bCRCHign As Byte Dim bCRCLow As Byte Dim len As Integer = pin.Length Dim crc_ta As UShort() = New UShort() {&H0, &H1021, &H2042, &H3063, &H4084, &H50a5, _ &H60c6, &H70e7, &H8108, &H9129, &Ha14a, &Hb16b, _ &Hc18c, &Hd1ad, &He1ce, &Hf1ef} crc = 0 For index As Integer = 0 To len - 1 ptr = pin(index) da = CByte(CByte(crc >> 8) >> 4) crc <<= 4 crc = crc Xor crc_ta(da Xor (ptr >> 4)) da = CByte(CByte(crc >> 8) >> 4) crc <<= 4 crc = crc Xor crc_ta(da Xor (ptr And &Hf)) Next 'Escape CR,LF,'H' characters bCRCLow = CByte(crc And &Hff) bCRCHign = CByte(crc >> 8) If bCRCLow = &H28 OrElse bCRCLow = &Hd OrElse bCRCLow = &Ha Then bCRCLow += 1 End If If bCRCHign = &H28 OrElse bCRCHign = &Hd OrElse bCRCHign = &Ha Then bCRCHign += 1 End If crc = CUShort(CUShort(bCRCHign) << 8) crc = crc Or bCRCLow Return crc End Function End ClassEnd Namespace Although, if you just want to request messages you could hard code the CRC into the request. Here's a capture of the traffic between WatchPower and the inverter, just copy/paste in the request strings and you should be good to go. https://github.com/scottwday/InverterEmulator/blob/master/doc/Capture.txt?raw=true

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.