Remote control by location (PIC in Oshonsoft)

Thread Starter

camerart

Joined Feb 25, 2013
3,835
Show the exact program, which won't work,
pins connected to LCD pins and BMP280 pins.
Chipselects in the LCD functions are missing.
The delays are now wrong.
Clock frequency = 32Mhz

I don't know if Oshonsoft accepts removing SPICSON, SPICSOFF, but try it.
Could also cheat it by defining SPI_CS__BIT some unused port pin.
Hi J,
I'll check all of these comments.

I have been trying different settings in a similar way, and so far I only get a one time 5110 with correct READings, until the screen has been CLEARED or disconnected to clear it.

From now, on if you're willing, I will only change anything as directed by you. This will save crossed wires and misunderstandings hopefully :) Perhaps one thing at a time.
C.
 
Last edited:

jjw

Joined Dec 24, 2013
823
Does the program 18lf4620 5510 bmb280 work in the new hw?

Edit: it seems that lcd chipselect is on all the time.
Then BMP280 SPI commands mess the LCD.
It is better, that the LCD cs on and off are inside the display routines.
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,835
Does the program 18lf4620 5510 bmb280 work in the new hw?

Edit: it seems that lcd chipselect is on all the time.
Then BMP280 SPI commands mess the LCD.
It is better, that the LCD cs on and off are inside the display routines.
Hi J,
No the program doesn't work on the latest PCB, unless I use the sequence mentioned. No program has worked without the 'sequence' on the latest PCB.

There are two programs, I think you mean the small one. Here it is corrected (marked ??????????????) This program doesn't give anything on the screen, even with the 'sequence'
C
 

Attachments

jjw

Joined Dec 24, 2013
823
In cmd5110 data/command selection is missing.

You said #333 is working , so why there are so many errors in chipselects and data/command signals?
You should use the same working program in new hw.
Only differences should be the used pins.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,835
In cmd5110 data/command selection is missing.

You said #333 is working , so why there are so many errors in chipselects and data/command signals?
You should use the same working program in new hw.
Only differences should be the used pins.
Hi J
#333 is only working on the test PCB.

I'll re-check it all. I occasionally mix up files :(

C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,835
In cmd5110 data/command selection is missing.

You said #333 is working , so why there are so many errors in chipselects and data/command signals?
You should use the same working program in new hw.
Only differences should be the used pins.
Hi J
As you know, #333 is only working on the test PCB.

I do sometimes mixes files up, I'll re-check.
C.
 

jjw

Joined Dec 24, 2013
823
The long wires to the lcd might be a problem.
You could make simple test of the LCD.
Leave in the program only the lcd part and display a short message.
 

jjw

Joined Dec 24, 2013
823
Hi J,
No the program doesn't work on the latest PCB, unless I use the sequence mentioned. No program has worked without the 'sequence' on the latest PCB.

There are two programs, I think you mean the small one. Here it is corrected (marked ??????????????) This program doesn't give anything on the screen, even with the 'sequence'
C
In the lcd routines lcd_cs=0 should be before lcd_dc
set lcd_cs=1 before End proc
The clock frequency is now 32Mhz ( pll x 4 )
Define clock frequency - > 32
I affects the delays() . I don't know if it is important, but the reset delay may be too short.
In this test no interrupts and Hserout are needed.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,835
Hi J
As you know, #333 is only working on the test PCB.

I do sometimes mixes files up, I'll re-check.
C.
Hi J,
Here is the transposed #333 program.
I've clarified the TRISD comment. (I previously had a CS numbering system, but that complicated things) BMP280 is altmtr = LATD.1.

The config OSC bits CONFIG1H are set for HS oscillator = 0x02, not HS oscillator PLL enabled 0x06, so 8MHz.

C.
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,835
The long wires to the lcd might be a problem.
You could make simple test of the LCD.
Leave in the program only the lcd part and display a short message.
Hi J,
As I will soon be needing a receiver, which is the same as a transmitter with different programs, I'll make it then I can try your suggestion.
C.
 

jjw

Joined Dec 24, 2013
823
Hi J,
Here is the transposed #333 program.

Top of program
4520 to 4620
lcd_mode -lcd_dc
lcd_reset -lcd_rst
changed.
C.
You have no lcd_cs=0 in the program.
They are needed at the beginning of every display routine and lcd_cs=1 at the end of routine.

Edit: ok there is once portd.4=0 which is the same as lcd_cs=0, but after first run of the loop it stays always on and in next loop 5110 is on and the BMP280 may mess it.
It is confusing to use randomly PORTD.4, LATD.4 and lcd_cs
 
Last edited:

jjw

Joined Dec 24, 2013
823
In #350 there is contradigting use of 5110 and BMP280 chipselects.
In TRISD there is a comment that bit 5 is chipselect for 5110
In program it is used for BMP280
Check all hw pins.

You should post only #333 converted to new hw where the pins are ok.
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,835
Does it work now on the new Pcb?
Hi J,
Yes, it's working on the latest PCB. Next I've got to try it on the large program.

If the large prgrm works, then I can fit the PCB into the Transmitter, and connect the last module, the incremental encoder.

Thanks, C.
 

jjw

Joined Dec 24, 2013
823
Oshonsoft arctan is not accurate. If I remember correctly, it has about 4 degrees error near 45 degrees.
I found some time ago an approximation function, which has better than 0.3 degrees accuracy and calculates the whole quadrant.
Can you find it ?
 

ericgibbs

Joined Jan 29, 2010
21,452
hi jjw,
Is this the version you are referring too.?
C and I used this some time ago.
E

Function arctan(atn As Single) As Single
If atn <= 1 Then
arctan = atn / (0.281125 * atn * atn + 1) * 57.296
Else
arctan = (1.5708 - atn / (atn * atn + 0.28125)) * 57.296
Endif
End Function
 

jjw

Joined Dec 24, 2013
823
It was
hi jjw,
Is this the version you are referring too.?
C and I used this some time ago.
E

Function arctan(atn As Single) As Single
If atn <= 1 Then
arctan = atn / (0.281125 * atn * atn + 1) * 57.296
Else
arctan = (1.5708 - atn / (atn * atn + 0.28125)) * 57.296
Endif
End Function
It was the first function, but it calculates in 8 octants.
I found another, which calculates the whole 90 degree quadrant.
I will search again or dig these threads.
 
Top