<div dir="ltr">Tak se mi nedaří 1-wire přidat na PORTE,2<div><br></div><div>Můžete na to prosím někdo mrknout jak se to dělá? Jak to přiřadím na konkrétní pin, čekal jsem něco v #define, ale nic takového kam bych dal port a pin tam nevidím, příklad k tomu není...<br>
<div><br></div><div><a href="https://github.com/ideras/pic-onewire-library/commit/7e12723bc44f9703b6f7d4ca9eebcd348d7eb762">https://github.com/ideras/pic-onewire-library/commit/7e12723bc44f9703b6f7d4ca9eebcd348d7eb762</a><br>
</div></div><div><br></div><div>podle mě by to mělo být přes funkci <span style="color:rgb(153,0,0);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:11.818181991577148px;font-weight:bold;line-height:18px;white-space:pre">OneWire_Init</span></div>
<div><br></div><div>Ta je definována takto, ale nějak z toho nejsem moc chytrý, zkoušel jsem <span style="color:rgb(153,0,0);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;font-weight:bold;line-height:18px;white-space:pre">OneWire_Init</span></div>
<span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">(</span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">struct</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">OneWire</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">*</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">this</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">volatile</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">IO_REG_TYPE</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">*</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">port</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">volatile</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">IO_REG_TYPE</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">*</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">ddr</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">uint8_t</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">pin</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">)</span><div class="gmail_extra">
<br clear="all"><div><br></div>
<br><br><div class="gmail_quote">Dne 26. ledna 2014 19:28 Jan Půhoný <span dir="ltr"><<a href="mailto:konference@puhy.cz" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=konference@puhy.cz&cc=&bcc=&su=&body=','_blank');return false;">konference@puhy.cz</a>></span> napsal(a):<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Takže ještě jednou díky za navedení. Už jsem se v MPLAB X a XC8 trochu zorientoval, displej a DS1302 už mi fungují :-) Dal jsem tam 18F46K22 a je to úplně pinově kompatibilní s PIC16F877A, takže nemusím předělávát plošňák.<div>

<br></div><div>Jak předpokládal wek, strávil jsem s tím dost času ...<br><div><br></div><div>Teď jsem narazil na pěknou knihovnu pro dallas 1 wire (např DS1820 teplotní čidla):</div><div><br></div><div><a href="https://github.com/ideras/pic-onewire-library" target="_blank">https://github.com/ideras/pic-onewire-library</a><br>

</div><div><br></div><div>Nerozumím ale definici portu, jak si to představují? Je tam tento zápis, kterému úplně nerozumím,</div><div><br></div><div>#define PIN_TO_BITMASK(pin)      (1 << pin)<br></div><div><br></div>

<div><div>// Platform specific I/O definitions</div><div>#define IO_REG_TYPE uint8_t</div><div>#define DIRECT_READ(port, mask)         (((*(port)) & (mask)) ? 1 : 0)</div><div>#define DIRECT_MODE_INPUT(ddr, mask)   (*(ddr)) |= (mask)</div>

<div>#define DIRECT_MODE_OUTPUT(ddr, mask)  (*(ddr)) &= ~(mask)</div><div>#define DIRECT_WRITE_LOW(port, mask)   (*(port)) &= ~(mask)</div><div>#define DIRECT_WRITE_HIGH(port, mask)  (*(port)) |= (mask)</div></div>

<div><br></div><div>to mám za "port" napsat třeba PORTE2 a mask = 0b00000010 ? nebo jak to chápat?</div><div><br></div><div>Bohužel žádný příklad u té knihovny není...</div><div><br></div><div>Díky za případné rady.</div>

<div class="gmail_extra"><br clear="all"><div>Honza Půhoný</div>
<br><br><div class="gmail_quote">2014-01-17 Jaromir Sukuba <span dir="ltr"><<a href="mailto:jarin.hw@gmail.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=jarin.hw@gmail.com&cc=&bcc=&su=&body=','_blank');return false;">jarin.hw@gmail.com</a>></span><div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">PIC18F4550 je asi najexotickejsi a najmenej kompatibilny z rady PIC18F.<br>
Skusil by som sa pozriet na PIC18F4520 (stary, ale prevereny typ),<br>
pripadne 18F45K20 (novsi, lacnejsi, ale iba do 3,6V) alebo 18F45K22<br>
(este novsi, o nieco drahsi - ale lacnejsi nez 18F4520 - ale ide do<br>
5,5V). Vo vsetkych troch pripadoch mozete nahradit 45 cislom 46, 44<br>
alebo 43 a dostanete modely s mensou alebo vacsou FLASH.<br>
Pripadne sa pozrite na PIC16F1517/1519 (tieto su moje oblubene), 1937/1934.<br>
Nieco sa da vybrat aj tu<br>
<a href="http://www.microchip.com/maps/microcontroller.aspx" target="_blank">http://www.microchip.com/maps/microcontroller.aspx</a> alebo si skuste<br>
pofiltrovat v nejakom katalogu, trebars u Farnella alebo Mousera.<br>
<br>
Inak, 16F877A bude fungovat tiez s XC8 kompilatorom, ale s tymito<br>
novsimi modelmi mate viac pamate "na minanie" a hlavne - nielen PORT,<br>
ale LAT aj PORT registre, velmi sikovna vec. Periferie su inak defakto<br>
zhodne s PIC16Fxxx, ale maju niektore pridane vlastnosti, ktore su ale<br>
defaultne vypnute (namatkou - inverzia signalov USARTu, moznost<br>
pouzivania 16-bitoveho BRG registra). Trebars inicializacia USART-u<br>
alebo SPI, ak si spominam spravne, je identicka s radou 16Fxxx ak<br>
nepouzivate tie vylepsenia. Kazdopadne je lepsie to porovnat v<br>
datasheetoch.<br>
<br>
<br>
2014/1/17 Jan Půhoný <<a href="mailto:konference@puhy.cz" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=konference@puhy.cz&cc=&bcc=&su=&body=','_blank');return false;">konference@puhy.cz</a>>:<br>


<div><div>> hmm, diky moc, samozrejme je to ono ...blb jsem spis ja a pro oci nevidim<br>
> :-) Už mi to bliká ....<br>
><br>
> Jeste se dovolim zeptat jak je to s knihovnami pro tu 16F řadu, já tam budu<br>
> muset dát zpátky asi ten PIC 16F877A protože na USB Vreg vývodu 18F4550  mám<br>
> zapojeny data od DS1302 RTC ... jinak to pinově sedí, ale tohle je trochu<br>
> problém :-) BTW: existuje něco z 18F řady co by 100% pinově sedělo s<br>
> PIC16F877A - nic podobnějšího než 18F4550 jsem nenašel. Mám tam zapojený<br>
> všechny vývody...<br>
><br>
> Je něco vyzkoušeného pro LCD displej nebo 1wire dallas čidla?<br>
><br>
> budou fungovat ty 18 knihovny pro 16 řadu ?<br>
><br>
> Díky.<br>
><br>
> Honza Půhoný<br>
><br>
><br>
> 2014/1/17 Jaromir Sukuba <<a href="mailto:jarin.hw@gmail.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=jarin.hw@gmail.com&cc=&bcc=&su=&body=','_blank');return false;">jarin.hw@gmail.com</a>><br>


>><br>
>> 2014/1/17 Jan Půhoný <<a href="mailto:konference@puhy.cz" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=konference@puhy.cz&cc=&bcc=&su=&body=','_blank');return false;">konference@puhy.cz</a>>:<br>


>> > #define _XTAL_FREQ=1000000<br>
>><br>
>> Zmente na<br>
>> #define _XTAL_FREQ 1000000<br>
>><br>
>> Tuto chybu mal Vas prvy zdrojak a ja blb som to po Vas vcera<br>
>> skopiroval bez toho, aby som to aj skusil skompilovat :-)<br>
>> _______________________________________________<br>
>> HW-list mailing list  -  sponsored by <a href="http://www.HW.cz" target="_blank">www.HW.cz</a><br>
>> <a href="mailto:Hw-list@list.hw.cz" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=Hw-list@list.hw.cz&cc=&bcc=&su=&body=','_blank');return false;">Hw-list@list.hw.cz</a><br>


>> <a href="http://list.hw.cz/mailman/listinfo/hw-list" target="_blank">http://list.hw.cz/mailman/listinfo/hw-list</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> HW-list mailing list  -  sponsored by <a href="http://www.HW.cz" target="_blank">www.HW.cz</a><br>
> <a href="mailto:Hw-list@list.hw.cz" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=Hw-list@list.hw.cz&cc=&bcc=&su=&body=','_blank');return false;">Hw-list@list.hw.cz</a><br>


> <a href="http://list.hw.cz/mailman/listinfo/hw-list" target="_blank">http://list.hw.cz/mailman/listinfo/hw-list</a><br>
><br>
_______________________________________________<br>
HW-list mailing list  -  sponsored by <a href="http://www.HW.cz" target="_blank">www.HW.cz</a><br>
<a href="mailto:Hw-list@list.hw.cz" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=Hw-list@list.hw.cz&cc=&bcc=&su=&body=','_blank');return false;">Hw-list@list.hw.cz</a><br>


<a href="http://list.hw.cz/mailman/listinfo/hw-list" target="_blank">http://list.hw.cz/mailman/listinfo/hw-list</a><br>
</div></div></blockquote></div></div></div><br></div></div></div>
</blockquote></div><br></div></div>