Hi Wayne,

Iirc I did not send you the code yet (so it is long overdue...)

Procedure PwmIrLed() acts like the pin for software_serial. But it is
not just a pin, it enables and disables pwm on ccp2. And it s ets the
pwm-pin c1 low when pwm is turned off, so the leds are actually off
(and not continuous on).

Joep

PS I changed the serial_software timing. Can you verify if it works
okay now for your k017 library?


-- ir_sender.jal

-- PwmIrLed - pulse led @ 56kHz or put it off.
procedure PwmIrLed'put(bit in ii) is
   if (ii) then
      ccp2con = 0x0c   ; pwm mode on
   else
      ccp2con = 0x00   ; pwm mode off
      pin_c1  = low
   end if
end procedure

-- ----------------------------------------------------------------------------
; setup serial_sw to pulse the IrLed
const bit serial_sw_invert = false
const serial_sw_baudrate = 1200
const serial_sw_stopbits = 0 -- don't send stop bits (actually, don't let the
                             -- serial routine *wait* for the stop bit)
var bit serial_sw_rx_pin
alias serial_sw_tx_pin is PwmIrLed
include serial_software

pin_c1_direction = output ; IrLed pin

; setup pwm for the IR led
T2CON = 4            ; timer 2 on, prescaler = 1, postscaler = 1
PR2 = 88             ; create 56 kHz pulse
ccpr2l = 44          ;

-- ----------------------------------------------------------------------------




2009/11/28 Wayne <[email protected]>:
> Joep Suijs wrote:
>> Hi Wayne,
>>
>> It seems that we have to dig deeper into this.
>> The only cause I can think of is the bit calculation overhead that adds to
>> each bit. Hower to verify this, I need time and my tools, which both are
>> currently unavailable due to some serious redecoration at home ;)
>> However, if you create an issue on googlecode, I'll look into
>> serial_software baudrates at lower clock rates some day.
>>
>> And about INTCON_GIE. This is used to disable interrutps. If your pic
>> doesn't have interrupts or you don't use them, you can just define a bit var
>> with this name. If your pic has interrupts and you use them, they have to be
>> disabled. You can do this yourself (and define the var) or use the
>> pseudo-var construct. I can provide you with some sample code if you want.
>
> Sample code is always welcomed, here!  I learn faster that way.
>
> I added var bit intcon_gie but the serial software lib keeps complaining
> about 'intcon_gie' not defined.  Then I pulled my head out of my --- and
> put it before the include serial_software.  Now i have '_irp' & '_plath'
> errors and also what I was afraid of 'Out of data space'.  I may be able
> to fix that though if I can get rid of the other errors.
>
> One reason I was asking about the documentation so much was that answers
> to the questions I have asked you in the past were, in my opinion, not
> available to the novice JALv2 programmers, which I am.  I have wanted to
> suggest that jallib start a FAQ section but hesitated due to the
> workload all of you Guru's have now.
>
>
> Thanks again Joep.  I hate bothering you on the weekend tho.  No rush on
> the sample code, take your time
>
> Wayne
>
>> Joep
>>
>> 2009/11/28 Wayne <[email protected]>
>>
>>>  Joep Suijs wrote:
>>>> 2009/11/24 Wayne [email protected]
>>>>
>>>>> Because I did not find any samples of how to use print.jal or format.jal
>>>>> with serial_sw_write.  I don't really understand enough to figure that
>>> out.
>>>>> I would like to know if they would work though.
>>>>>
>>>> Just init the serial software comms like you do now and use
>>> serial_sw_data
>>>> as the first param in stead of serial_hw_data.
>>>> Haven't tested this, but it should work...
>>>>
>>> Joep
>>>
>>>   I am integrating a Maxim DS18B20 into my application and asked on
>>> jallist if anyone had a jallib lib they were working on.  I got a
>>> response, with a link, to one that Helge<[email protected]> had
>>> modified from on that Stef had written back in 2002/4.
>>>
>>>   In looking at the application I noticed that Helge also had a problem
>>> getting 9600 baud with a 4 MHZ clock on a 16c84. He had this in the code
>>> const serial_sw_baudrate = 10400 (this is really 9600 baud).
>>>
>>> I just tried that with the 16f628a_lcd_k107sample.jal. What do you know,
>>> the k107 communicates with LCD now with a 4 MHZ Crystal.
>>>
>>> I am reporting this but wish I had the answer as to why this works.  I
>>> also hope that someone else wanting to work at 9600 baud can use the
>>> information above.
>>>
>>>   I still can't use it on the 12f509 due to the lack of INTCON_GIE
>>> which is required by the serial_software.jal lib but sure would like to.
>>>  :-)
>>>
>>> Best Regards
>>>
>>> Wayne
>>>
>>> --
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "jallib" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<jallib%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/jallib?hl=en.
>>>
>>>
>>>
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups 
>> "jallib" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/jallib?hl=en.
>>
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/jallib?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.


Reply via email to