<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>i don't like this:</div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "> delay100(5);</blockquote></div></blockquote><div><div>in a "real Time System"</div><div><br></div><div>Better to put a sub in an timer/interrupt routine.</div><div>I think we have enough timer.</div><div><br></div><div>Bye</div><div>Michael</div><div><br></div><div>Am 05.09.2013 um 10:29 schrieb Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>>:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Håkon,<div><br></div><div>I think I'd like to keep utils.{h,c} simple. Just have standardised functions to set the digital output on/off.</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>void io_digital_set(port, onoff);</div><div>unsigned char io_digital_get(port);</div></blockquote></div><div><br></div><div>Then, put the logic for how it is used in the vehicle module itself.</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>if (io_digital_get(4)==0)</div><div>  {</div><div>  io_digital_set(4,1);</div><div>  delay100(5);</div><div>  io_digital_set(4,0);</div><div>  }</div></blockquote></div><div><br></div><div>We would also need to initialise the ports in the correct way, and standardise what ports are used for input and what for output. I will look at this later tonight.</div><div><br></div><div>Regards, Mark.</div><div><br><div><div>On 5 Sep, 2013, at 3:14 PM, Håkon Markussen <<a href="mailto:hakon.markussen@gmail.com">hakon.markussen@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div><div>I'm sorry that my programming skills are not the best and have to ask about this. But to get this baby going I need some more detailed help.<br><br></div>In the utils.c (and utils.h) can I add two functions, and then call them from the vehicle-specific?<br>
</div>One function (lock) sets RB4 high for 500ms and the other fuction (unlock) sets RB5 high for 500ms.<br><br></div>Do you think this will work?<br><div><br>void send_lock(void)<br>  {<br>  // Check if RB4 is low, set RB4 high for 500ms and back to low<br>
  if (PORTBbits.RB4 == 0)<br>  {<br>    PORTBbits.RB4 = 1;<br>    delay100(5);<br>    PORTBbits.RB4= 0;<br>  }<br><br>void send_unlock(void)<br>  {<br>  // Check if RB4 is low, set RB4 high for 500ms and back to low<br>  if (PORTBbits.RB5 == 0)<br>
  {<br>    PORTBbits.RB5 = 1;<br>    delay100(5);<br>    PORTBbits.RB5 = 0;<br>  }<br> <br><br></div><div>Br.<br>Håkon<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/5 Mark Webb-Johnson <span dir="ltr"><<a href="mailto:mark@webb-johnson.net" target="_blank">mark@webb-johnson.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Unfortunately, no free UART on the low-end PIC18 we are using. We could do a software UART, but given all the other stuff going on, that would concern me.<div>
<br></div><div>I don't mind adding some stuff to utils.{c,h} for controlling digital outputs, if you want to go that route.</div><div><br></div><div>Regards, Mark.</div><div><div class="h5"><br><div><div>On 4 Sep, 2013, at 10:13 PM, Mastro Gippo <<a href="mailto:gipmad@gmail.com" target="_blank">gipmad@gmail.com</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr">Hi,<div>for the K stuff: K line is just an async serial, at battery levels, at 10400bps 8n1. should be very easy to control from OVMS, with a mosfet on a serial TX pin for output, if there's a free UART.</div>


<div>About the switches, if they are low current push buttons connected to the ECU that just short to ground, you can easily use any mosfet (2n7000 is my favourite) to "buffer" the PIC output. You will just need to connect the Source pin to ground, the Drain to the other side of the button, and the gate to the PIC pin, with a 1K to 10K resistor to ground. I'd go with that option.</div>


<div>About the software, I haven't enough experience to help you, sorry.</div><div>Regards</div><div>MG</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/4 Håkon Markussen <span dir="ltr"><<a href="mailto:hakon.markussen@gmail.com" target="_blank">hakon.markussen@gmail.com</a>></span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>Hi all,<br><br></div>I see there is currently some HW discussion ongoing, so I'm picking up this post again:<br>


<br></div>I want to implement the doorlock control for Think City (vehicle_thinkcity.c) to the app.<br>
</div><br>The problem is that the module controlling the door locks (General Electric Module from Ford, part 17ST-15K600-KB) uses K-line only.<br></div>I think the door lock switch can be triggered (K-line style) with request 22 A1 45  which returns 62 A1 45 40 for lock or 62 A1 45 80 for unlock.<br>



</div><div>I have tried to address via other ECU's which also talk k-line, but with no success.<br></div><div><br></div>The GEM lock switch can be triggered by applying a gnd-pulse to the lock/unlock switch input. The pin voltage measure about 3,5V when no gnd is applied.<br>



<br>My current idea for solution is using RB4 and RB5 on the OVMS 9x2, connect it to the GEM unlock switch and GEM lock switch.<br></div>The question is:<br></div>  1) Do I need a transceiver between the Ovms-module (RB4/RB5) and the GEM-module (unlock/lock switch) for protection? If yes, any suggestions of type/device?<br>



</div><br>  2)  Are there anybody with the knowledge (and time) to re-write the utility.c/utility.h so the vehicle specific files can utilize the extra pins (RB4/RB5 for my case)?<div><div><br></div><div>  3) Anybody with a better solution?<br>



<br></div><div>Best regards<br></div><div>Håkon Markussen<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/8/24 Mark Webb-Johnson <span dir="ltr"><<a href="mailto:mark@webb-johnson.net" target="_blank">mark@webb-johnson.net</a>></span><br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="word-wrap:break-word"><div><br></div><div>Over the past year or so, I've had a few people ask me the same sort of question, so thought a single reply here would help.</div>



<div><br></div><div>On the v2 module circuit board there is a unpopulated 9x2 set of holes in the board. You can see it on the attached picture, between the crystal and LEDs.</div><div><br></div><div>You can either solder directly to this, or use a header plug/socket arrangement. All the unused pins from the PIC are brought out via that header, as well as GND, +5V and +12V. There are several free analog input pins, as well as digital input/output pins available for expansion. They are all 5V TTL level.</div>



<div><br></div><div>If someone wants to use these for something, I suggest you code utils.h/utils.c to provide a function to initialise and control the required ports. Just try to make it fairly non-specific so it is of some use to others. Then, the vehicle module can just call the appropriate utils.c function, presumably in response to an SMS / net_msg command.</div>



<div><br></div><div>For bi-directional sync/async comms, things are a little bit more tricky. The I2C pins are used by the LEDs, so you would have to sacrifice those and hack the code to use I2C. You could in theory do a software async, but I think that would be tricky. The DIAG port is just a tap between the PIC and the modem. Probably the best, for something sophisticated, is to use the CAN bus.</div>



<div><br></div><div>Regards, Mark.</div><div><br></div><div><br></div><div><img width="320" height="210"><img width="320" height="240"></div>
</div><br></div>_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
</blockquote></div><br></div></div></div><br>_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></div></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br></blockquote></div><br></div></body></html>